Skip to content

Instantly share code, notes, and snippets.

@schmuli
Forked from M-Zuber/info.md
Created April 20, 2017 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmuli/cca5db09bd339c9043f759c85d96be03 to your computer and use it in GitHub Desktop.
Save schmuli/cca5db09bd339c9043f759c85d96be03 to your computer and use it in GitHub Desktop.
typescript config/concepts explanations
  • target tells TS what type of JS to generate, for es5 for conversion is required (for example let/const -> var, class -> function + prototype, etc.), whereas es6 can just leave the original code as is (after removing type information).
  • types tells TS about what types exists and what their API is. When using lib you are asking TS to add known core types that it already has definitions for, without having to add those yourself (for example, @types/core-js). When you import you adding more types that TS knows about. Additionally, you can use the types configuration property to add global types.
  • polyfills are required at runtime to ensure that older browsers can use the constructs (such as Promise) that exist natively in modern browsers. At this point, TS is not involved at all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment