tsconfig

How to handle a project with multiple tsconfig.json files?

自作多情 提交于 2019-12-01 17:53:28
I'm working on a project structured like this: \ |- built |- src |- perf |- tsconfig.json |- typings |- tsconfig.json My tsconfig.json on the root "target": "es6", "outDir": "built", "rootDir": "./src", I need a different configuration on the perf folder, like a different target. "target": "es5", However, my typings folder is on the root of my project, not inside perf folder. So doing a tsc ./perf results in a lot of errors. Is there a way to tell TypeScript where to look for typings ? I'm using npm install -g typescript@next // typescript@1.8.0-dev.20151109 Or a way to have different

How to handle a project with multiple tsconfig.json files?

给你一囗甜甜゛ 提交于 2019-12-01 17:24:40
问题 I'm working on a project structured like this: \ |- built |- src |- perf |- tsconfig.json |- typings |- tsconfig.json My tsconfig.json on the root "target": "es6", "outDir": "built", "rootDir": "./src", I need a different configuration on the perf folder, like a different target. "target": "es5", However, my typings folder is on the root of my project, not inside perf folder. So doing a tsc ./perf results in a lot of errors. Is there a way to tell TypeScript where to look for typings ? I'm

How to exclude `node_modules/@types/**/node_modules`?

本小妞迷上赌 提交于 2019-12-01 17:16:46
问题 I have run into a situation where a type definition in node_modules/@types is installing its own @types dependencies, and these "nested" @types conflict with my top level @types. @types |-angular //v1.5 |-angular-ui-bootstrap |-node_modules |-@types |-angular //v1.6 How can I exclude node_modules/@types/**/node_modules in my tsconfig? One caveat - I am using awesome-typescript-loader, which may have some limitations. What I've tried: 1 - file glob in the exclude property to exclude the nested

How to configure tsconfig.json to output files from multiple source folders to single flat outDir?

女生的网名这么多〃 提交于 2019-12-01 07:57:24
问题 I have multiple typescript projects (e.g. client and server ), which share some common functionality (located in a common folder). Consider this folder structure: + client | - tsconfig.json | + src | - client.ts + common + src - util.ts Where the client.ts imports the utility this way: import { Util } from '../../common/src/util'; For brevity I am omitting the server folder, which is at the same level as client . After the transpilation into the out folder, I would like to get this simple

How to import repo with uncompiled TypeScript in Angular 5+ (and exclude .spec.ts files)

喜夏-厌秋 提交于 2019-12-01 03:29:26
A recent upgrade to Angular 5.x is not allowing uncompiled TypeScript to import from a node_modules repo. It looks like the workaround is to include the .ts files using tsconfig.json via "include": ["node_modules/example/**/*.ts"] ; however, this includes .spec.ts files, which are causing errors. Backtracking a bit, if your repo is uncompiled, you get an error that looks like: ERROR in ./node_modules/example/lib/core/example.ts Module build failed: Error: /Users/example/Work/example/example/node_modules/example/lib/core/example.ts is missing from the TypeScript compilation. Please make sure it

How to import repo with uncompiled TypeScript in Angular 5+ (and exclude .spec.ts files)

你。 提交于 2019-12-01 00:22:55
问题 A recent upgrade to Angular 5.x is not allowing uncompiled TypeScript to import from a node_modules repo. It looks like the workaround is to include the .ts files using tsconfig.json via "include": ["node_modules/example/**/*.ts"] ; however, this includes .spec.ts files, which are causing errors. Backtracking a bit, if your repo is uncompiled, you get an error that looks like: ERROR in ./node_modules/example/lib/core/example.ts Module build failed: Error: /Users/example/Work/example/example

Overriding `tsconfig.json` for ts-node in mocha

独自空忆成欢 提交于 2019-11-30 12:26:31
问题 Is it possible to override which tsconfig.json ts-node uses when called from mocha? My main tsconfig.json contains "module": "es2015" , but I want to use "module": "commonjs" for ts-node only. I tried this mocha --compilers ts:ts-node/register,tsx:ts-node/register \ --compilerOptions '{"module":"commonjs"}' \ --require ts-node/register test/**/*.spec.ts* but it did not work: SyntaxError: Unexpected token import at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:387:25) at

Setting up tsconfig with spec/test folder

南楼画角 提交于 2019-11-27 23:24:59
Say I put my code under src and tests under spec : + spec + --- classA.spec.ts + src + --- classA.ts + --- classB.ts + --- index.ts + tsconfig.json I want to only transpile src to the dist folder. Since index.ts is the entry point of my package, my tsconfig.json look like this: { "compileOptions": { "module": "commonjs" "outDir": "dist" }, "files": { "src/index.ts", "typings/main.d.ts" } } However, this tsconfig.json does not include the test files so I could not resolve dependencies in them. On the other hand, if I include the test files into tsconfig.json then they are also transpiled to

Typescript- What is target in tsconfig?

别等时光非礼了梦想. 提交于 2019-11-27 20:59:00
I am quite new to Typescript. What does Target in tsconfig.json signify? { "compilerOptions": { "sourceMap": true, "target": "es5", "module": "commonjs", "jsx": "react", "moduleResolution": "classic", "lib": [ "es2015", "dom", "es2017" ] } } I am quite new to Typescript. What does Target in tsconfig.json signify? target signifies which target of JavaScript should be emitted from the given TypeScript . Examples: target:es5 ()=>null will become function(){return null} as ES5 doesn't have arrow functions. target:es6 ()=>null will become ()=>null as ES6 has arrow functions. Target changes the

what is the purpose of tsconfig.json?

被刻印的时光 ゝ 提交于 2019-11-27 20:32:27
I was reading angular2 referrences and found this tsconfig.json . I would like to know what the following parameters mean? { "compilerOptions": { "target": "es5", "module": "system", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false }, "exclude": [ "node_modules" ] } The tsconfig.json file corresponds to the configuration of the TypeScript compiler (tsc). These links could give you details about these attributes: http://www.typescriptlang.org/docs/handbook/tsconfig-json.html http://json