Skip to content
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

Hover on as const shows type const = /*unresolved*/ any in 4.5.2 #46998

Closed
yume-chan opened this issue Dec 3, 2021 · 3 comments Β· Fixed by #47000
Closed

Hover on as const shows type const = /*unresolved*/ any in 4.5.2 #46998

yume-chan opened this issue Dec 3, 2021 · 3 comments Β· Fixed by #47000
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@yume-chan
Copy link
Contributor

Bug Report

πŸ”Ž Search Terms

as const

πŸ•— Version & Regression Information

  • This changed between versions 4.4.4 and 4.5.2

⏯ Playground Link

Playground link

πŸ’» Code

42 as const

Hover on const

πŸ™ Actual behavior

image

πŸ™‚ Expected behavior

Shows type const = 42 or nothing as in 4.4.4

This also affects Semantic Highlighting in vscode microsoft/vscode#138362

@jakebailey
Copy link
Member

jakebailey commented Dec 6, 2021

See also #47043; the Playground appears to have a different hover implementation, as it allows you to hover on const, wheras VS Code does not; if we want to fix #47043 and have const have the keyword type, then we probably need to ensure that the same thing happens to const as does to as, not emit a type like 4.5 or #47000, with consistent behavior between VS Code and the playground.

@jakebailey
Copy link
Member

jakebailey commented Dec 6, 2021

Hm, this is even more confusing. Switch the playground back to 4.4, and you get no hover, whereas 4.5 does have the (wrong) type. But, even testing #47043 with the linked PR, no matter what I do, the token is always a "type".

The hover doesn't work on my machine, but @DanielRosenwasser tried it on his and the hover worked.

@jakebailey
Copy link
Member

Seems like the hover is present in VS Code's insiders, just not on the stable build, which explains the discrepancy.

Hopefully this means that the semantic tokenization takes a different path so #47043 can be fixed separately, but thankfully it at least means the linked PR is good to go as it's not impacted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants