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
54
votes
6 answers

What is the purpose of tsconfig.json?

I was reading Angular2 references and found this: tsconfig.json. I would like to know what the following parameters mean? { "compilerOptions": { "target": "es5", "module": "system", "moduleResolution": "node", …
Bhushan Gadekar
  • 13,485
  • 21
  • 82
  • 131
47
votes
9 answers

node_modules/@types/node/index.d.ts(20,1): error TS1084: Invalid 'reference' directive syntax

I have a problem with typescript compilation. Has anybody else received this error? node_modules/@types/node/index.d.ts(20,1): error TS1084: Invalid 'reference' directive syntax. tsconfig.json: { "compileOnSave": false, "compilerOptions":…
heyJoe
  • 571
  • 1
  • 4
  • 4
45
votes
8 answers

Visual Studio Code can't resolve angular's tsconfig paths

I'm trying to import some services using barrels and tsconfigs paths options but I can't get angular and vscode to get along. If it works for one it doesn't for the other and viceversa... My situation seems to be pretty simple: in src/app/services…
Doc
  • 5,078
  • 6
  • 52
  • 88
45
votes
2 answers

Best practice to setup tsconfig "files" vs "include"?

I was wondering what is better and what are the pros and cons of using "files" vs "include" in tsconfig? I don't really like the include pattern because is just including all ts files in the src folder, and I might now want that. I like the "files"…
Totty.js
  • 15,563
  • 31
  • 103
  • 175
45
votes
5 answers

How to get tsc to Resolve Absolute Paths when Importing Modules using baseUrl?

Consider a simple typescript project with the following directory structure: | package.json | tsconfig.json | \---src | app.ts | \---foobar Foo.ts Bar.ts tsconfig.json has been configured…
Zsw
  • 3,920
  • 4
  • 29
  • 43
42
votes
4 answers

exclude subdirectories in tsconfig.json

I have installed TypeScript 1.8.2, and using Visual Studio 2015. I have a simple project where I have problems excluding folders from the tsconfig.json file. The problem is I would like to exclude the file typings/browser.d.ts and the folder…
DNRN
  • 2,397
  • 4
  • 30
  • 48
37
votes
4 answers

Typescript paths not resolving when running jest?

Attempting to convert this project over to jest using these instructions. I have everything working except for the files that use the paths configuration: "paths": { "@fs/*": ["./src/*"], "@test/*": ["./test/*"] } It looks as if…
Ole
  • 41,793
  • 59
  • 191
  • 359
37
votes
2 answers

Visual Studio 2017, JavaScript intellisense inconsistencies

TL;DR: How do you include a tsconfig.json file in Visual Studio 2017 and still have JavaScript intellisense work like it does by default, giving code hints both for your own code and 3rd-party libraries? Is it borked, or do I just need a better…
36
votes
8 answers

(ESLint/Cypress): Parsing error: ESLint was configured to run on `/component/TestComponent.cy.ts` using `parserOptions.project`

I am setting up a new project with Remix (remix.run) and I am trying to configure Cypress/ESLint for component testing. I have a TestComponent.cy.ts with some boilerplate code: describe('TestComponent.cy.ts', () => { it('playground', () => { …
T. Duke
  • 646
  • 1
  • 6
  • 17
36
votes
1 answer

What is module option in tsconfig used for?

I am trying to understand the typescript module compiler option. I went through typescript documentation - docs It says module option is to Specify module code generation. What does that mean? Does it mean if I put module option as commonjs, then…
troglodyte07
  • 3,598
  • 10
  • 42
  • 66
35
votes
5 answers

tsc - doesn't compile alias paths

I have typescript and uses the aliases. Here is part of tsconfig.json "compilerOptions": { "baseUrl": "./src", ... }, By setting the base url, I can change import User from "src/models/User.model.ts" to import User from…
ahadortiz
  • 916
  • 1
  • 9
  • 20
34
votes
4 answers

ts-node execute typescript with module import and module defined

I try to initialize database base via typescript. my ts is like: import { User, UserRole } from '../entity/User'; import crypto from 'crypto'; import {dbManager, pwhash } from '..'; async function inituser() { const user = new User(); …
user504909
  • 9,119
  • 12
  • 60
  • 109
34
votes
6 answers

Webpack ts-loader : change tsconfig filename

I have 2 tsconfigs, one for my dev build and one for my prod build. I choose the tsconfig with the -p flag : tsc -p dev.tsconfig.json Ts-loader is looking for a tsconfig.json file. How can I specify another filename with the…
gr3g
  • 2,866
  • 5
  • 28
  • 52
33
votes
2 answers

Angular language service in VSCode does not work because it is not an Angular project ('@angular/core/core.d.ts' could not be found)

Somehow the Angular (v11.0.4) language service in VSCode does not work anymore. I get the following error message.: [Info - 17:52:04] Angular language server process ID: 147359 [Info - 17:52:04] Using typescript/lib/tsserverlibrary v4.0.5 from…
33
votes
7 answers

Exclude files from build in Angular 2

How to exclude files from the Angular build using Angular-CLI. I've just added the path to exclude in the tsconfig.json and tsconfig.app.json files, but when I run ng serve, Angular is still trying to compile the files. Any ideas?
Matías González
  • 1,366
  • 3
  • 15
  • 30
1
2
3
81 82