You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VS Code Intellisense seems to wrongly infer revealing module pattern #18496
varGreeter=(function(country){// Privatethis.country=country;functiongetCountry(){returncountry;}// PublicvarperformGreeting=function(name){varcountry=getCountry();return'Hello '+name+', from '+country;}return{greet: performGreeting}});vargreeter=newGreeter("The Netherlands");console.log(greeter.greet("Lody"));console.log(greeter.country);
Using the revelealing module pattern in VS Code seems to trip up Intellisense into suggesting the wrong members. The code above was tested in multiple browsers and consoles and run with Node v6.3.0 which behaved as expected. They ran the greet() function and returned undefined for greeter.country:
λ node greeter.js
Hello Lody, from The Netherlands
undefined
But VS Code's Intellisense reports that greeter only contains country:
It also reports the expected interface of greeter for the class itself (Greeter):
What is expected is VS Code correctly inferring greeter.greet to be a function of Greeter, with a parameter name.
This was reproduced in a clean folder of VS Code, with no extensions (launched with code --disable-extensions), and no jsconfig.json.
Activity