ITADN

Function with no return type passes with type signature

#234Openkaleidawave 创建于 2025-09-19
K
kaleidawavecommented
The following currently emits no diagnostics ```typescript function func(): number {} ``` > [playground link](https://kaleidawave.github.io/ezno/playground/?id=95mlmw) The problem being that the only time return types are checked are around `return` statements. Not *implicit* `undefined` returns. This should be fairly simple to fix. But there is probably a bit more to think about in terms of where and how the diagnostic is emitted. For example for the following ```typescript function func(): number { if (Math.random() > 0.8) return 2; else { something.here(); } } ``` Maybe the diagnostic should be on the `else` clause? There are similar conditions for `while` etc
0 条评论