2

Consider function below, it doesn't return promise, yet typescript doesn't warn about unnecessary use of await here. Is there a way to enforce this?

enter image description here

Ilja
  • 44,142
  • 92
  • 275
  • 498
  • Awaiting a non-promise does have an effect, check out [my old question](https://stackoverflow.com/questions/55262996/does-awaiting-a-non-promise-have-any-detectable-effect). – ttulka Dec 21 '19 at 12:08

1 Answers1

3

This is by design, so don’t expect Typescript to be raising the error you’re looking for any time soon.

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

KRyan
  • 7,308
  • 2
  • 40
  • 68