A library for Typescript package authors to:
- publish multiple type declaration files using the new typesVersions feature available in Typescript 3.1
- determine the minimum Typescript version that a package is compatible with
yarn add -D ts-typesversions
There are two primary intended uses for this project:
- As a CLI to check project compatibility with different Typescript versions
- Programmatically as part of an npm/yarn release process
yarn run ts-typesversions
This will invoke an interactive CLI where you can opt to:
- just check compilation compatibility with different versions of Typescript
- generate declaration files for different TS versions
For full usage instructions, run:
yarn run ts-typesversions --help
We suggest that you add yarn run ts-typesversions --declarations
as part of the prepublishOnly
step of the
package publish lifecycle.
For example:
{
"scripts": {
"prepublishOnly": "rm -rf dist && tsc && yarn run ts-typesversions --declarations"
}
}
To limit the supported versions to only a subset of Typescript releases you can supply the
--ts-versions
option.
yarn run ts-typesversions --declarations --ts-versions 3.1,3.0,2.9,2.8