-
Notifications
You must be signed in to change notification settings - Fork 13.2k
tsserver: get candidates from <K extends keyof Foo> (fix #12536) #12543
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
Conversation
|
Hi @wonderful-panda, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
| } | ||
|
|
||
| function addStringLiteralCompletionsFromType(type: Type, result: CompletionEntry[]): void { | ||
| if (type && type.flags & TypeFlags.TypeParameter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you get the type constraint and the type is a keyof type, where is that handled below?
src/services/completions.ts
Outdated
|
|
||
| function addStringLiteralCompletionsFromType(type: Type, result: CompletionEntry[]): void { | ||
| if (type && type.flags & TypeFlags.TypeParameter) { | ||
| type = (<TypeParameter>type).constraint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should use checker::getApparentType here instead. it does some more than just checking the constraint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to do that, you will need to expose this method on TypeChecker interface.
mhegazy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments listed erlier
|
Thank you for the review. I've pushed new version. |
Fixes #12536