According to the TypeScript 3.1 release notes, typescript provides a way to ship stricter types in npm packages by setting the typesVersions field in package.json like so:
{
"name": "package-name",
"version": "1.0",
"types": "./index.d.ts",
"typesVersions": {
">=3.1": { "*": ["ts3.1/*"] }
}
}
However, the docs do not indicate how the specified ts3.1/index.d.ts file is created. Do I have to manually write an index.d.ts file at this location? Is there a way with typescript or a related build tool to conditionally generate stricter types?