HMR
HMR

Reputation: 39320

Typescript project cannot find module after vscode update

VS code was harassing me every time I start it up to update so this morning I did and now many ts files cannot find modules anymore.

Many files have statements like:

 import Mustache = require("mustache");

These files do not have a statement like:

 ///<reference path="./typings/mustache.d.ts" />

But since another file in the project has that statement it used to be no problem. Somehow; once I referenced "mustache" somewhere I didn't need to repeat the process in other files and could directly require it.

I updated to:

Version 1.6.0
shell 1.3.7
node 6.5.0

If anyone could help out on how to solve this problem I would greatly appreciate it.

task.json:

{
    "version": "0.1.0",
    "command": "tsc.cmd",
    "isShellCommand": true,
    "showOutput": "silent",
    "problemMatcher": "$tsc"
}

node tsc:

C:\Users\me>tsc.cmd
Version 1.8.10

tsc.exe:

C:\Users\me>tsc.exe
Version 1.8.2

In the root of the source directory I added a index.d.ts with the following content:

///<reference path="./typings/mustache.d.ts" />
///<reference path="./typings/jquery.2.1.3.d.ts" />
///<reference path="./typings/settings.typing.ts" />

But files can still not find mustache unless I add the type definition in the file it self.

Uninstalled vs code and installed it again but same problem (same version)

[UPDATE]

Downloaded 1.5.3 and all the problems went away

Upvotes: 0

Views: 944

Answers (1)

Roberts Slisans
Roberts Slisans

Reputation: 194

At the base of your source files (i.e., src/ ) make an index.d.ts file with all the ///'s

This continues to work for me even on:

Version 1.6.0 Commit e52fb0b... Renderer 52.0 Node 6.5.0

You could try installing the second latest version and see if the problems you are having with the latest version still persist.

Upvotes: 1

Related Questions