Why is ES7/array polyfill needed despite the tsconfig target is set to ES5

TypeScript does not auto-polyfill code (see microsoft/TypeScript#3101). The “official” reason from the relevant GitHub issue seems to be, as @RyanCavanaugh said: Having the compiler try to figure out which [ES20XX] methods you need, and where to emit them, and when, with controls for people who don’t want the polyfills emitted, and ways to change where … Read more

Setting up tsconfig with spec/test folder

I ended up defining multiple config files and use extends to simplify them. Say I have two files: tsconfig.json and tsconfig.build.json // tsconfig.json { … “exclude”: […] } // tsconfig.build.json { … “files”: [ “typings/index.d.ts”, “src/index.ts” ] } This way, I can have fine control on what to build (using tsc -p tsconfig.build.json) and what … Read more

What is target in tsconfig.json for?

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. More I also made a quick video … Read more

How to use paths in tsconfig.json?

This can be set up on your tsconfig.json file, as it is a TS feature. You can do like this: “compilerOptions”: { “baseUrl”: “src”, // This must be specified if “paths” is. … “paths”: { “@app/*”: [“app/*”], “@config/*”: [“app/_config/*”], “@environment/*”: [“environments/*”], “@shared/*”: [“app/_shared/*”], “@helpers/*”: [“helpers/*”] }, … Have in mind that the path where you … Read more