Support compatibility with previous TS versions for npm packages #41685
Labels
Declined
The issue was declined as something which matches the TypeScript vision
Suggestion
An idea for TypeScript
Search Terms
compatibility previous typescript versions
Suggestion
Allow me to use the latest and greatest version of Typescript but allow me to specify the minimum TS version I want the emitted declaration files to be compatible with.
Use Cases
For example I might want to use the latest version of Typescript so that I could use the
// @ts-expect-error
in my tests but I might want my compiled package to be usable with TS 3.1. The emitted declaration files would not include this so would be compatible with 3.1Examples
Latest and greatest features of TS could be used freely anywhere in the code. As soon as this results in incompatible types being emitted in the declaration files TS throws an error saying this is incompatible.
This would allow new features to be used within a function (where it will not affect the declaration files) but if you wanted to return an incompatible type you would be stopped.
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: