Skip to content

Latest commit

 

History

History
78 lines (57 loc) · 2.97 KB

extra.md

File metadata and controls

78 lines (57 loc) · 2.97 KB

Reference

To check

What if the types in your library make use of the latest TypeScript (conditional types, bigint etc.), but your users are still using an older version?

{
  "name": "package-name",
  "version": "1.0",
  "types": "./index.d.ts",
  "typesVersions": {
    ">=3.1": { "*": ["ts3.1/*"] }
  }
}

What Target?

Downleveling

  • downlevelIteration
    • previously generators, operators that work on Iterator (for..of) were only supported in ES6/ES2015
    • with this this flag they can be downleveled to ES3/5
  • noEmitHelpers
    • disables generating helpers code (__extends, __awaiter, __generator etc.) for each file
  • importHelpers
    • imports those helpers ☝️ once for generated code

Types field

Also note that if your main declaration file is named index.d.ts and lives at the root of the package (next to index.js) you do not need to mark the "types" property, though it is advisable to do so

Files field

Type only libraries

Declaration map

Module browser keys in package.json