Skip to content

Errors from missing references to non-@types .d.ts files do not disappear after npm install #35966

@uniqueiniquity

Description

@uniqueiniquity

TypeScript Version: 3.7.3

Search Terms:
DirectoryWatcher, missing reference

Repro steps

  1. In Visual Studio, create a new ASP.NET Core Web Application with the Angular template.
  2. Open main.ts, expect to see to red squiggles under the two imports because the @types packages haven't yet been installed.
  3. Open package.json and save to trigger npm install.
  4. Once done, reopen main.ts.

Expected behavior:
Errors go away when NPM install finishes.
Actual behavior:
Errors remain, even when typing. Removing the typeRoots setting in the tsconfig causes the errors to go away.

Also repros in VS Code
To reproduce in VS Code, create the same template using VS, but then open in VS code and npm install from the command line.

It seems like once the npm install finishes, the referenced files should be added to the project from some sort of watcher, but they're not until a change is made to the tsconfig. I imagine this is specifically related to the intended .d.ts files not being in the @types folder. I did confirm that this reproduces even without an explicit typeRoots setting.

Related Issues:
#14818

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions