-
Notifications
You must be signed in to change notification settings - Fork 469
Incorrect type information on hover with async/await #6013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The code:
|
I think the hover shows the type of what's "under the code" which has a type error: the enclosing function. |
This happens to me too all the time, it makes debugging a little difficult because when there's any kind of error in an async function you can't inspect any other types in the call When working with records, this breaks intellisense/autocomplete which then makes it hard to fix. I typically find myself needing to flip through modules to find what a field was named type output = {outDir: string}
let build = async () => {
Promise.resolve({outDir: "dist"})
}
let serve = outDir => "localhost" ++ outDir
let devServer = async () => {
let output = await build()
serve(output.dir) // <-- "dir" instead of "outDir"
}
|
Something is indeed wrong. We'll be investigating this soon. |
Can you add a screenshot of the hover when there's the type error without async? |
Take a look at this compiler PR which should fix that: #6012 |
It happens when there's a compilation error inside of an async/await function. On hover, it shows a type of the async function instead of the hovered value. Works fine with normal functions in the same file.
The text was updated successfully, but these errors were encountered: