Skip to content
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

Intellisense doesn't work with constant function parameters #4990

Closed
startrekdude opened this issue Apr 5, 2016 · 2 comments
Closed

Intellisense doesn't work with constant function parameters #4990

startrekdude opened this issue Apr 5, 2016 · 2 comments
Assignees

Comments

@startrekdude
Copy link

  • VSCode Version: 0.10.11
  • OS Version: Windows 10

Steps to Reproduce:

files.zip

  1. Create a file called SomeAPI.js with the following content:
var SomeAPI = (function () {
   "use strict";  
    var exports = {};

    exports.sayHello = function (name) {
        alert("Hello, " + name);
    }

    return exports;
})();
  1. Create a file called SomeAPI.d.ts with the following content:
declare namespace SomeAPI {
    function sayHello (name: string) => void;
}
  1. Create a file called app.js with the following content:
/// <reference path="./SomeAPI.d.ts"/>
(function (SomeAPI) {
    "use strict";

    var hello = function () {
        SomeAPI.sayHello(document.body); // Oops! No Intellisense!
    }

    document.addEventListener("DOMContentLoaded", hello);
})(SomeAPI); // This one works
  1. Mouse over the line where it says "SomeAPI.sayHello" (in app.js).

Observed Behaviour:
Visual Studio Code's Intellisense informs the user that SomeAPI is of the any type, as is it's child sayHello.

Expected Behaviour:
Visual Studio Code informs the user that SomeAPI is a namespace and that sayHello is a function that takes a string.

Why this bug is important to fix:
Immediately-Invoked Function Expressions were a common way of doing modules and scoping before ES6's (awesome) import statements. There is a lot of legacy code that still uses them.

@egamma
Copy link
Member

egamma commented Apr 7, 2016

Moving to TypeScript for investigation

@egamma
Copy link
Member

egamma commented Apr 7, 2016

This issue was moved to microsoft/TypeScript#7928

@egamma egamma closed this as completed Apr 7, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants