-
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
JavaScript IntelliSense Should Recognize DefineProperty #26082
Comments
Likely duplicate of Duplicate of #6651 |
@mjbvz -- Not exactly. More like this: `function Person(name) {
|
@johnnykahalawai they are the same issue. the type system does not recognize calls to |
Hi @mhegazy - I see. One man's opinion here but without defineProperty support salsa is missing the cilantro. Aloha, Johnny |
Another example would be: // add.js
function add (x, y) {
return x + y;
}
module.exports = add; Example 1 (adding getter directly to the object): // index.js
const o = {
get add () {
return require('./add');
}
};
const sum = o.add(2, 3); // 5 In example 1, Intellisense recognizes the add function from Example 2 (adding getter via defineProperty): // index.js
const o = {};
Object.defineProperty(o, 'add', {
get: function () {
return require('./add');
}
});
const sum = o.add(2, 3); // 5 In example 2, Intellisense fails to recognize the function and mistakenly expects the function to return a promise. I am working on a utility that would allow the developers to have cleaner, aesthetic imports, where this feature is necessary to be useful for the developers who will use it. |
From @johnnykahalawai on July 30, 2018 19:19
Issue Type: Feature Request
Hi -
Often when working with JavaScript an object i.e. class is extended with Object.defineProperty
Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
Unfortunately, Visual Studio's IntelliSense cannot make this connection so the GoTo Definition feature does not work.
FWIW, JetBrain's products e.g. WebStorm and IntelliJ does support this feature.
Thanks in advance,
Johnny
VS Code version: Code 1.25.1 (1dfc5e557209371715f655691b1235b6b26a06be, 2018-07-11T15:33:29.235Z)
OS version: Darwin x64 17.7.0
Copied from original issue: microsoft/vscode#55390
The text was updated successfully, but these errors were encountered: