TypeScript - Publishing Types & DefinitelyTyped

Bundled types

  • Emit declarations with "declaration": true and point "types" in package.json to the entry .d.ts.
  • Keep your public API stable; treat types as part of the API contract.

Publishing

npm publish --access public

DefinitelyTyped

For JS libraries without bundled types, contribute to DefinitelyTyped (@types/<pkg>). Follow the DT guidelines, add tests, and ensure semantic versioning.