Visual Studio Code complains that it “Cannot find namespace” for types defined in *.d.ts files

前端 未结 4 1189
甜味超标
甜味超标 2021-01-19 10:06

I created a new project using the gulp-angular Yeoman generator with language set to TypeScript. Then ran the Gulp build process and also opened the page in a web browser, w

4条回答
  •  执笔经年
    2021-01-19 10:08

    I had the same problem; it appears typings was stripping the original definition file referencing the "ng" import.

    Add this back to your original angular/index.d.ts file:

    // Collapse angular into ng import ng = angular;

    Or better yet, place it in a ng.d.ts file so it's not overwritten by typings again.

提交回复
热议问题