As mentioned in the TypeScript 3.1 release notes, typescript allows for stricter type shipping in npm packages through the typesVersions
field in package.json
with the following configuration:
{
"name": "package-name",
"version": "1.0",
"types": "./index.d.ts",
"typesVersions": {
">=3.1": { "*": ["ts3.1/*"] }
}
}
However, it is not specified in the documentation how the designated ts3.1/index.d.ts
file should be generated. Do I need to manually create an index.d.ts
file at this location? Is there a method within typescript or a related build tool to generate stricter types conditionally?