tsconfig.json compiler options - JavaScript support Flashcards

1
Q

What does allowJs compiler option do?

A

Allow JavaScript files to be imported inside your project, instead of just .ts and .tsx files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does checkJs compiler option do?

A

Works in tandem with allowJs. When checkJs is enabled then errors are reported in JavaScript files. This is the equivalent of including //@ts-check at the top of all JavaScript files which are included in your project.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does maxNodeModuleJsDepth compiler option do?

A

The maximum dependency depth to search under node_modules and load JavaScript files.

This flag is can only be used when allowJs is enabled, and is used if you want to have TypeScript infer types for all of the JavaScript inside your node_modules.

Ideally this should stay at 0 (the default), and d.ts files should be used to explicitly define the shape of modules. However, there are cases where you may want to turn this on at the expense of speed and potential accuracy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly