typescript - 等待非 Promise 函数时没有 typescript 警告

标签 typescript

考虑下面的函数,它不返回 promise ,但 typescript 不会警告此处不必要地使用等待。有办法强制执行吗?

enter image description here

最佳答案

这是by design ,所以不要指望 Typescript 很快就会引发您正在查找的错误。

但是,TSLint can provide a warning or error for this case .

关于typescript - 等待非 Promise 函数时没有 typescript 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59436027/

相关文章:

javascript - 仅在 ng build 后才看到错误

typescript - 如何在 TypeScript 中同步运行 Promise?

javascript - 删除 httpOnly cookies - Express

javascript - 错误 : bundle initial-es5 exceeded maximum budget. 预算 6.00 MB 未满足 133.51 kB 总共 6.13 MB

Angular2 事件发射器未得到处理

javascript - Angular - 在当前 ts 文件中包含额外的 ts 文件

reactjs - React 样式组件

javascript - typescript |仅允许传递满足传递键类型的值

javascript - webpack ts-loader 错误 : loaderContext. getOptions 不是函数

typescript - TypeScript混淆错误 'Object is possibly ' undefined'和 'Property ' length'在类型上不存在