TypeScript 5.1 Beta 发布
TypeScript 5.1 发布了首个 Beta 测试版。 主要变化 更智能地检查未定义返回值的函数(undefined-Returning Functions) 旧代码 function foo() { // no return } // x = undefined let x = foo(); // fine - we inferred that 'f1' returns 'void' function f1() { // no returns } // fine - 'void' doesn't need a return statement function f2(): void { // no returns } // fine - 'any' doesn't need a return statement function f3(): any { // no returns } // error! // A function whose declared type is neither 'void' nor 'an...
