Closed
Description
People are always excited to use new type system features in their programs or definition files.
However, if these developers are shipping a library with bundled type definitions, they can't use these features in an exposed way unless they are willing to force all TS consumers of the library to upgrade to a matching compiler version.
This leads to awkward trade-offs and end-user confusion when they upgrade eventually does happen.
There should be some way for library authors to say "Use this .d.ts file if you're on this version of TypeScript" so they can provide back-compat ranges. This could be based on semver ranges provided in package.json
:
{
...
"types-compat": {
"<=2.3": "backcompat/index-2.3.d.ts",
"<=2.7": "backcompat/index-2.7.d.ts",
"*": "index.d.ts"
}
}