[TypeScript] Using Exclude and RootDir until File Globs Lands in 2.0.
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[TypeScript] Using Exclude and RootDir until File Globs Lands in 2.0.相关的知识,希望对你有一定的参考价值。
Files globs will be available in TypeScript 2.0, so in the meantime, we need to use "exclude" and "rootDir" to configure which files to load. This lesson shows how to switch from "files" to "exclude".
Curently, in tsconfig.json, we use "files" to tell the main entry file as "src/main". And import other file into main.ts. But the problem is if you want add each files manually into "files" config setting, IDEs cannot give the autocomplete for the rest of files.
From TypeScript 2.0 We will be able to get the auto complete by just current setting, but for now we need to use "exclude" and "rootDir" to tell TypeScript which files we want to use.
{ "compilerOptions": { "rootDir": "src", "module": "commonjs", "target": "es5", "noImplicitAny": false, "sourceMap": false, "outDir": "./dist", "noEmitOnError": true }, "exclude": [ "node_modules" ] }
以上是关于[TypeScript] Using Exclude and RootDir until File Globs Lands in 2.0.的主要内容,如果未能解决你的问题,请参考以下文章
[TypeScript] Using Assertion to Convert Types in TypeScript
[TypeScript] Using Lodash in TypeScript with Typings and SystemJS
[TypeScript] Type check JavaScript files using JSDoc and Typescript 2.5
[Algorithms] Quicksort algorithm using TypeScript