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
32
votes
2 answers

How to have absolute import paths in a library project?

I have a library with a workspace containing two projects, one for the library itself and one for a test application. ├── projects    ├── midi-app    └── midi-lib In the workspace tsconfig.json file I configured some @app and @lib paths: "paths":…
Stephane
  • 11,836
  • 25
  • 112
  • 175
30
votes
1 answer

How to exclude specific files in typescript only for the build?

Is it possible to exclude all test files only for the build but use them with nodemon to run tests locally? When I exclude test files within the tsconfig.json file I get a typescript error that it can't find the types of the testing library like…
thiloilg
  • 1,733
  • 2
  • 18
  • 23
30
votes
8 answers

Angular 6 application cannot find namespace 'google'

This question has appeared similarly in many places where the solution is to simply add import { } from '@types/googlemaps'; which worked as a solution in past versions of angular. The issue appeared now that I am using Angular 6+ TS2304: Cannot…
Murphy4
  • 1,499
  • 2
  • 15
  • 22
27
votes
1 answer

typescript tsconfig.json include exclude not working

I have a web project I have folders src/app/shared/models src/app/shared/services src/app/shared/types Each one of those is subfolder that have folders or files inside it, I want to exclude those folders, So i tried: "include": [ "src/**/*" …
Zakk
  • 758
  • 3
  • 11
  • 20
25
votes
2 answers

eslint rule @nrwl/nx/enforce-module-boundaries fails

Intro I was very confused with that rule when I recently ported the Ng code base to Nx 12.x. I hope this post helps others who begin migrating from Ng to Nx. The code base above is a rather small single repo which is now used in production. When…
Juri Sinitson
  • 1,445
  • 1
  • 14
  • 18
24
votes
3 answers

How to set paths property in a project with multiple tsconfig.json?

I have the following file structure |__ app1/ | |__ tsconfig.json |__ utilities/ | |__ files.ts |__ base-tsconfig.json In base-tsconfig.json I have set the paths property as following "compilerOptions": { "baseUrl": ".", …
starcorn
  • 8,261
  • 23
  • 83
  • 124
24
votes
1 answer

skip library check only in node_modules

There are several questions about disabling errors in mistyped node_modules (e.g., this one, or this one), but they all involve using the skipLibCheck compiler flag. Are there other solutions to this problem (e.g., using include or exclude)? I have…
Felipe
  • 3,003
  • 2
  • 26
  • 44
24
votes
6 answers

How can I compile my Typescript into a single JS file with no module loading system?

I have a small Typescript project of about 10 ts files. I want to compile all my files into es5 and into a single es5 file called all.js. Currently, with my tsconfig.json set up as { "compilerOptions": { "module": "system", "target":…
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
23
votes
4 answers

Possibility of Suppressing any error (e.g. incl. TS7017) within a config file (e.g. tsconfig.json)

I would like to suppress any desired error; TS7017 is only an example. Maybe it is possible now? Can TypeScript v4++ help? I want to achieve something like (e.g., in the compilerOptions in tsconfig.json): // ATTENTION PSEUDO CODE suppressErrors:…
user3025289
22
votes
2 answers

How to get rid of the "@rollup/plugin-typescript: Rollup 'sourcemap' option must be set to generate source maps." warning?

I get this warning every time I build for production. When I build for production I disable source maps in the rollup output config. output: [{ dir: "...", format: "...", sourcemap: isProd ? false : true }] I use the same tsconfig for dev and…
user1283776
  • 19,640
  • 49
  • 136
  • 276
22
votes
2 answers

Preventing inappropriate imports and enforcing project hierarchy in Typescript

In a TS project I'd like the following to be blocked: A file from folder common importing from folder projectA A file from folder projectB importing from folder projectA I'd like the following to be allowed: A file from folder projectA importing…
Ben Carp
  • 24,214
  • 9
  • 60
  • 72
22
votes
2 answers

TypeScript 3.7.2 - Support for the experimental syntax 'optionalChaining' isn't currently enabled

In my project I am using TS 3.7.2 which should support optional chaining. But when I try to use it like that: const state = urlParams.state?.toString() I get the error: Support for the experimental syntax 'optionalChaining' isn't currently…
flppv
  • 4,111
  • 5
  • 35
  • 54
21
votes
2 answers

Prevent Typescript compiler from checking entire classes to save time?

Typescript compilation is taking a long time to run, so I used generateTrace from https://github.com/microsoft/TypeScript/pull/40063 It showed that most of the time was comparing complicated classes with their subclasses. E.g. one of the classes is…
Leo Jiang
  • 24,497
  • 49
  • 154
  • 284
21
votes
2 answers

Extend a "paths" tsconfig file for a monorepo

I've got a folder structure like so: - mono-repo tsconfig.paths.json - Website tsconfig.json - src test.ts index.ts - Tool - src index.ts // mono-repo/tsconfig.paths.json { "compilerOptions": { "paths": { …
Seph Reed
  • 8,797
  • 11
  • 60
  • 125
21
votes
2 answers

Monorepo with paths from Typescript is not working

I have monorepo (yarn workpaces) with following file structure: ├── client (workspace @client) │   ├── package.json │   └── tsconfig.json (extended tsconfig) ├── server (workspace @server) │   ├── getData.ts │   ├──…
J V
  • 703
  • 2
  • 7
  • 12
1 2
3
81 82