Typescript: Check if element types of Promises contain a property when issuing a missing property error

Created on 27 Mar 2018  路  3Comments  路  Source: microsoft/TypeScript

function f(x: Promise<string>) {
  x.toLowerCase()
}

Expected: Property 'toLowerCase' does not exist on type 'Promise<string>'. Did you forget to await the 'Promise<string>'?

Actual: Property 'toLowerCase' does not exist on type 'Promise<string>'.

Error Messages Fixed Suggestion good first issue help wanted

Most helpful comment

PRs welcomed. great first issue. will diffidently add value to our users.

All 3 comments

PRs welcomed. great first issue. will diffidently add value to our users.

The follow up to this issue is to add a quick fix to add the await keyword.

I'll try to fix this.

Was this page helpful?
0 / 5 - 0 ratings