Issue
How to make package built on top of TS 4.X compatible with 3.X? Like, if you have newer version -> use new features, else -> use any
or unknown
or whatever is supported in older version.
Is there any possibility to use directives for that purpose?
Solution
There is no way to switch between supported and unsupported features in TypeScript.
For instance, if you have a library which is built on top of TS 4.0 with variadic tuple types
there is no way to use it in a package where TS 3.0 is used.
However, you can maintain two versions of your typings: before TS4 and after TS4. For instance, take a look how lodash or react maintaince several versions of typings.
Answered By - captain-yossarian from Ukraine
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.