-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Go to definition cannot work as expected #15218
Comments
The issue is not go-to-def. the issue is that the type of If you are running with TS 2.3 or later, we have a change only under |
@mhegazy Thanks for your explanation. It works after I added the parameter. But I meet the same problem when I put the object as parameter:
|
how is |
I don't think it's quite related to the function definition. But you can take jQuery extend function as reference.
|
if it was defined using generics instead: declare function extend<T>(target: T): any; you would get your You can take this one step further and make the type of declare function extend<T, U, V>(target: T & ThisType<T & U & V>, object1: U & ThisType<T & U & V>, object2: V & ThisType<T & U & V>): any;
extend({
"abc": function () {
return 1;
},
"def": function () {
this.abc(); // OK
}
},
{
"another": function () {
this.def(); // OK
}
},
{
"yetAnother": function () {
this.another(); // OK
}
}); you can find more info about the use of |
Actually, I just want to use Visual Studio Code to develop in JavaScript, which is is using TypeScript as JS compiler. But I cannot use "declare function ..." in JS code. |
Where is extends comming from? VSCode gets your declarations form an @types package, so updating it should do the trick without you having to change your code. |
Extends is one of functions in my JS library. Here is only a example. I don't think I can add all the functions declaration manually. |
This issue seems to have been already addressed or is unactionable at the moment. I am auto-closing it for now. |
Here is the case:
This function works well in sublime
The text was updated successfully, but these errors were encountered: