Mark Probst
Mark Probst

Reputation: 7367

Visual Studio Code doesn't recognize TypeScript module from `node_modules`

Cloned the tslint repository, did npm install and grunt, as told in the README, and opened the folder in Visual Studio Code (0.9.1). Looking at any .ts file - src/rules/typedefRule.ts, say - gives TypeScript errors on require "typescript": Cannot find module 'typescript'.

The typescript module is in the node_modules folder, but VSC doesn't seem to know about that. How do I tell it to?

Upvotes: 1

Views: 3335

Answers (1)

basarat
basarat

Reputation: 276161

The typescript module is in the node_modules folder, but VSC doesn't seem to know about that. How do I tell it to?

Two things:

  • The current version of typescript that vscode uses doesn't support typings lookup. You will need to update it to latest (typescript nightly) using the tssdk setting
  • The current typescript used by tslint (1.6.2) doesn't have typings field. You need to update tslint as well (a much bigger task).

Suggestion: Follow the other steps in readme and use THEIR definition file : https://github.com/palantir/tslint#custom-rules

Upvotes: 0

Related Questions