Questions tagged [tsconfig]

tsconfig.json files are configuration for TypeScript projects. They contain the command line options to tell TSC (the TypeScript transpiler) how to build the JavaScript output.

tsconfig.json files are configuration for TypeScript projects. They contain the command line options to tell TSC (the TypeScript transpiler) how to build the JavaScript output.

Options can also include directives for the TypeScript editor, such as whether to compile on save and (in some editors) code formatting options.

The schema can be found at http://json.schemastore.org/tsconfig

For more details, see What is a tsconfig.json?.

The term "TSconfig" can also (much more rarely) refer to TypoScript used in the proprietary TYPO3 CMS.

1216 questions
21
votes
1 answer

How to use different tsconfig file for test files in vscode?

This question is similar to this question: How to use different tsconfig file for tests? But I am asking for visual studio code. I have two tsconfig files: tsconfig.json for all application files tsconfig.test.json for all test files tsconfig.json…
Michael Hilus
  • 1,647
  • 2
  • 21
  • 42
21
votes
2 answers

How to type check a single file from command line, using the setting in tsconfig.json?

Normally I run tsc -p ./tsconfig.json which type checks all files in the ./src folder relative to tsconfig. But if I run tsc -p ./tsconfig.json src/specific-file.ts, it complains error TS5042: Option 'project' cannot be mixed with source files on a…
trusktr
  • 44,284
  • 53
  • 191
  • 263
21
votes
2 answers

With just typescript (no webpack and no bable), can I get a multiple file solution to run in a browser?

What would the tsconfig.json need to be to make this work in Chrome? So that I only had to run tsc and could then view the file in a browser and the appropriate result would display in the console? index.html contains: …
Steven T. Cramer
  • 1,508
  • 1
  • 18
  • 34
20
votes
7 answers

@types/eslint Error: ChainExpression and ImportExpression members of ESTree not exported

I am having some troubles after executing my angular application with npm start, 'ChainExpression' & 'ImportExpression'members of ESTree interface are not exported causing errors... Please check image below: I am using Angular 12 and next node…
Alberto Bricio
  • 402
  • 1
  • 6
  • 22
20
votes
1 answer

Disable strictTemplates per file not entirely

I have a large project with many files. Now I want to use strictTemplates, so I added the following lines in: tsconfig.json ... "angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictTemplates": true ...…
20
votes
6 answers

compilerOptions.paths must not be set (alias imports are not supported)

I'm trying to map paths in tsconfig.json to get rid of relative paths hell. My React App is based on Create-React-App. I tried this SO thread and added paths in my tsconfig.json. My tsconfig.json is as { "compilerOptions": { "baseUrl": "src", …
DevLoverUmar
  • 11,809
  • 11
  • 68
  • 98
20
votes
1 answer

What does tsconfig.spec.json do?

I have seen this and this posts and they have made me understand tsconfig.app.json and tsconfig.json. I have an angular app which has tsconfig.app.json, tsconfig.json and tsconfig.spec.json What is the role of tsconfig.spec.json? What does the…
YulePale
  • 6,688
  • 16
  • 46
  • 95
20
votes
2 answers

Include CSS files in tsc TypeScript compilation

I am trying to create a React TypeScript NPM package. I have finished my code and created package.json and tsconfig.json. But inside my package I also have a bunch of CSS files that I want to include in my package. This is my tsconfig.json: { …
BluePrint
  • 1,926
  • 4
  • 28
  • 49
20
votes
2 answers

What is the use-case of enabling declaration and declarationMap in tsconfig.json?

If we enable sourcemap which allows us to debug on the browser. Likewise looking for the use case of declaration and declarationMap. I have searched over the internet, but my bad could not found the actual use case except generating .d.ts file.
Sathishkumar
  • 239
  • 2
  • 9
20
votes
3 answers

Create react app typescript does not load d.ts file

I have created a project using create react app typescript. I have a few d.ts files where I have defined interfaces types and enums. When I run start script. It is not able to load the d.ts files. following is my tsconfig file. { …
Anurag Sharma
  • 241
  • 1
  • 2
  • 7
20
votes
2 answers

Cannot find type definition file for 'node' in Typescript/React app

I noticed not too long ago, whenever I try to start my app, I receive plenty of Cannot find name 'require' and Cannot find type definition file for 'node' and a Cannot find type definition for 'react-router' Some solutions I have already tried…
john.zli
  • 511
  • 2
  • 4
  • 13
20
votes
4 answers

Specific tsconfig.json rules inside folder

How can I use an inner config.json in my Typescript project? For clarity: I have a root /config.json as following: { "compilerOptions": { "module": "commonjs", "target": "es2017", "inlineSourceMap": true, …
Gustavo Lopes
  • 3,794
  • 4
  • 17
  • 57
20
votes
1 answer

Environment specific tsconfig.json

Is there a way how to set tsconfig.json environmentally specific such as tsconfig.prod.json and tsconfig.dev.json? I want to have sourceMap and comments on dev environment, but I want to remove these on production.
Andree
  • 1,159
  • 2
  • 17
  • 32
19
votes
5 answers

How to fix "Flag 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5."?

Does anybody know how to fix this tsconfig error? Flag 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5. Specify 'ignoreDeprecations: "5.0"' to silence this error. Use 'verbatimModuleSyntax' instead. I use vscode…
19
votes
2 answers

Why are dom and dom.iterable separate?

In tsconfig.json you can define additional libs, that give you typings for HTML or DOM "libraries"(? I don't know the correct terminology). I don't understand why dom and dom.iterable are separate. Were they defined in different ecma…
Manuel Meister
  • 332
  • 3
  • 12