Skip to content

Visual Studio not immediately recognizing d.ts files added via NuGet #1759

@nycdotnet

Description

@nycdotnet

Visual Studio does not immediately recognize d.ts files that are added via NuGet. It seems that the first time a definition is added in this way, the file needs to be manually referenced or the project needs to be unloaded/reloaded.

Repro:

  • Brand new Windows 8.1 fully patched with VS 2013 Community Edition (Update 4).
  • Create a new HTML Application with TypeScript.
  • Change the app.ts to show this code:
window.onload = () => {
  console.log($('#content').length);
}
  • Go to Manage... NuGet Packages...
  • Download the jquery.TypeScript.DefinitelyTyped package.
  • The error "could not find symbol $" will remain. Expected: The error should go away.
  • Create a reference manually in app.ts : /// <reference path="scripts/typings/jquery/jquery.d.ts" />
  • Now the error will go away because Visual Studio includes the definition in the compilation.
  • Remove the reference and save the file, the error will come back. Expected: The error should not come back.
  • Right-click "Unload Project", Right-click "Reload Project". Now the error will go away and VS will properly include the jquery.d.ts in the compilation. Expected: It should not have been necessary to reload the project.

This is also a problem if you have the new TypeScript 1.4 VS extension installed. In addition to the project unload/reload, closing and re-opening Visual Studio will also work around the issue. This happens in VS 2013 Pro also - I just wanted to see if it would repro on a completely clean machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptWon't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions