Reference typescript definitions in one file, instead of all JS files?

后端 未结 2 1746
野的像风
野的像风 2021-01-05 03:10

I\'m working on a Node JS (+Express) project in Visual Studio Code, and am wondering if there is a way to reference TypeScript definitions in one global spot, rather than ha

2条回答
  •  一个人的身影
    2021-01-05 03:34

    In some editors you can use the filesGlob property in tsconfig.json to simplify references.

    For example:

    "filesGlob": [
        "./scripts/*.ts",
        "!./node_modules/**/*.ts"
    ]
    

    However, this will work with the TypeScript compiler only when TypeScript 2 is released (see globs):

    Or you can specify individual files:

    "files": [
        "./scripts/app.ts",
        "./scripts/other.d.ts"
    ]
    

提交回复
热议问题