Skip to content

Commit a5b5bb0

Browse files
authored
Update README.md
1 parent 50c6427 commit a5b5bb0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,30 +146,36 @@ _Environment variable denoted in parentheses._
146146

147147
**TypeScript Node** does _not_ use `files`, `include` or `exclude`, by default. This is because a large majority projects do not use all of the files in a project directory (e.g. `Gulpfile.ts`, runtime vs tests) and parsing every file for types slows startup time. Instead, `ts-node` starts with the script file (e.g. `ts-node index.ts`) and TypeScript resolves dependencies based on imports and references.
148148

149-
For global definitions, you can use the `typeRoots` compiler option. This requires that your type definitions be structured as type packages (not loose TypeScript definition files). More details on how this works can be found in the [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types).
149+
For global definitions, you can use the `typeRoots` compiler option. This requires that your type definitions be structured as type packages (not loose TypeScript definition files). More details on how this works can be found in the [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types).
150150

151151
Example `tsconfig.json`:
152+
152153
```
153154
{
154155
"compilerOptions": {
155156
"typeRoots" : ["./node_modules/@types", "./typings"]
156157
}
157158
}
158159
```
160+
159161
Example project structure:
162+
160163
```
161-
<projcet_root>/
164+
<project_root>/
162165
-- tsconfig.json
163166
-- typings/
164167
-- <module_name>/
165168
-- index.d.ts
166169
```
170+
167171
Example module declaration file:
172+
168173
```
169174
declare module '<module_name>' {
170175
// module definitions go here
171176
}
172177
```
178+
173179
For module definitions, you can use [`paths`](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping):
174180

175181
```json

0 commit comments

Comments
 (0)