TypeScript
TypeScript copied to clipboard
JavaScript IntelliSense does not suggest methods added to built-in prototypes
Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: 1.106.3
- OS Version: Windows 10 22H2
Steps to Reproduce:
- Ensure
javascript.suggest.enabledis set to true:
/** @file .vscode/settings.json */
{
"javascript.suggest.enabled": true
}
- Create a JavaScript file with the following content:
Promise.prototype.log = function() {
this.then(console.log)
}
const promise = new Promise(r=>r(3));
promise.log();
- Place the cursor after
promise.(beforelog()) as shown below
- Observe that the
logmethod is not suggested by IntelliSense, even though it exists on the prototype ofPromise.
Global merges like this aren't supported; you'll need to use a .d.ts file for this
This issue has been marked as "Not a Defect" and has seen no recent activity. It has been automatically closed for house-keeping purposes.