[TypeScript] Using Exclude and RootDir until File Globs Lands in 2.0.
typescript in and File Using 2.0 until
2023-09-14 08:59:19 时间
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 + React] Tip: Use generics in React to make dynamic and flexible components
- [React Typescript 2022] Use TypeScript to Type a React Class Component
- [React Typescript 2022] Type a Radio Button Component in React using TypeScript
- [Typescript] Use the Optional Chaining Operator in TypeScript
- [Typescript] Exclude Properties from a Type in TypeScript (Omit)
- [TypeScript] Query Properties with keyof and Lookup Types in TypeScript
- [VueJS + Typescript] Decouple Dependencies Using IoC Containers in Vue with TypeScript and InversifyJS
- [Vue + TS] Create your own Decorators in Vue with TypeScript
- [TypeScript] Create random integers in a given range
- [TypeScript] Union Types and Type Aliases in TypeScript
- [TypeScript] Using Lodash in TypeScript with Typings and SystemJS
- [Typescript] Generics in Function Overloads
- [Typescript] Statically Type Unknown Values with TypeScript's unknown Type
- [Typescript] Create Type From Any Given Data in TypeScript
- [Typescript] “Record” Mapped Type
- [React] Use React.ReactNode for the children prop in React TypeScript components and Render Props
- [TypeScript] Deeply mark all the properties of a type as read-only in TypeScript
- [Typescript] Specify Exact Values with TypeScript’s Literal Types
- [Vue +TS] Use Two-Way Binding in Vue Using @Model Decorator with TypeScript
- [TypeScript] Function Overloads in Typescript
- [TypeScript] Using Exclude and RootDir until File Globs Lands in 2.0.
- Matlab:成功解决In an assignment A(I)=B,the number of elements in B and I must be the same