-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Use declared type parameters in signature help #15412
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 real problem is that we don't use a declared type parameter when getting signature help. declare function f<T>(x: T): void;
f<number>( Signature help here still shows |
I don't know, if it fits exactly to this problem, but i'm struggling with the autocompletion while using keyof. function keyofTest<Type>(context: Type, key: keyof Type)
{
return context;
}
class Test
{
a: string;
b: number;
}
keyofTest<Test>(new Test(), "a") // this works as expected
keyofTest(new Test(), "") // this not really The second function call shows me all possible types, while the cursor is before the comma, but not between the quotes anymore. A wrong key would also be marked. Two images attached to see the behaviour: |
@dkirchhof In the second case type inference has failed, since we can't infer any type |
Sorry, but i don't get it. At first, it shows me all possible keys ( |
It works in the compiler layer but that information doesn't get to services which provides the completions. I've made an issue #20843. |
From: microsoft/vscode#25363
TypeScript Version: 2.3.1
Code
Trigger suggestions inside of the quotes in the function call.
Expected behavior:
Returns suggestions for
abc
andxyz
Actual behavior:
No suggestions returned in this case.
If a non-generic type is used:
Then suggestions are returned
The text was updated successfully, but these errors were encountered: