tsconfig

what is the purpose of tsconfig.json?

本秂侑毒 提交于 2019-11-27 12:48:47
问题 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" ] } 回答1: The tsconfig.json file corresponds to the configuration of the TypeScript compiler (tsc). These links could give you

Typescript image import

坚强是说给别人听的谎言 提交于 2019-11-27 06:01:01
问题 I found a solution here: Webpack & Typescript image import But i am getting error for this: [ts] Types of property 'src' are incompatible. Type 'typeof import("*.png")' is not assignable to type 'string | undefined'. Type 'typeof import("*.png")' is not assignable to type 'string'. I guess i need to cast import somehow, but cant figure out how. I am doing this in React. I saw that src attribute is defined as string | undefined , that is why error is popping. Here is code: import * as Logo

Setting up tsconfig with spec/test folder

…衆ロ難τιáo~ 提交于 2019-11-27 03:01:34
问题 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.

Typescript- What is target in tsconfig?

混江龙づ霸主 提交于 2019-11-26 20:22:58
问题 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" ] } } 回答1: 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

How to use paths in tsconfig.json?

余生颓废 提交于 2019-11-26 15:46:38
I was reading about path-mapping in tsconfig.json and I wanted to use it to avoid using the following ugly paths: The project organization is a bit weird because we have a mono-repository that contains projects and libraries. The projects are grouped by company and by browser / server / universal. How can I configure the paths in tsconfig.json so instead of: import { Something } from "../../../../../lib/src/[browser/server/universal]/..."; I can use: import { Something } from "lib/src/[browser/server/universal]/..."; Will something else be required in the webpack config? or is the tsconfig