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

前端 未结 4 1242
甜味超标
甜味超标 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:24

    Adding a tsconfig.json to the root of my VS Code project is what fixed the issue for me. Also, had to restart VS code. Here is what I put inside that file:

    {
        "compilerOptions": {
            "target": "es5",
            "module": "commonjs",
            "sourceMap": true
        }
    }
    

    For more info on the tsconfig.json file, check out:

    https://code.visualstudio.com/docs/languages/typescript

提交回复
热议问题