Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document correspondence between TypeScript and tslib versions #22

Open
calebegg opened this issue Feb 3, 2017 · 11 comments
Open

Document correspondence between TypeScript and tslib versions #22

calebegg opened this issue Feb 3, 2017 · 11 comments

Comments

@calebegg
Copy link

calebegg commented Feb 3, 2017

Tagged tslib versions don't seem to correspond in any obvious way to TypeScript versions. I want to be able to confidently import the right tslib version to work with a given TS version. Maybe just a table in the readme would be enough?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 3, 2017

support of importHelpers was added in TS 2.1. you should be able to use any version of tslib with any version of TS post TS 2.1. Obviously the behavior you get from the helpers depends on what version of the library you are using.

Is there a specific issue you found with different versions of the library and/or TS?

@calebegg
Copy link
Author

calebegg commented Feb 4, 2017

v1.0.0 doesn't have __generator, so it won't work with 2.1's async/await support. And v1.5.0 has a version of __extends that uses Object.setPrototypeOf, which is a change slated for TS 2.2; I don't want to introduce new breaking changes to our large TS 2.1 codebase.

I just happened to notice those. There might have been other changes in the other versions. I want to just be able to exactly match the behavior of TS 2.1 without noEmitHelpers.

@aluanhaddad
Copy link
Contributor

@calebegg the use of Object.setPrototypeOf is guarded, making it non-breaking from an environmental perspective.

@calebegg
Copy link
Author

I didn't mean to say that that change was a breaking one, but that there might be other breaking changes. And with our large codebase, even innocent seeming changes like that can cause issues for anyone depending on the old behavior.

I just want to be able to get a version that works just like TS does on its own without having to research each change to know when it went in.

@aluanhaddad
Copy link
Contributor

@calebegg Fair enough. I support this request.

@frankwallis
Copy link
Contributor

There is some info in the release notes (https://github.com/Microsoft/tslib/releases)

NOTE: This is a breaking change from TypeScript 2.3.2 and earlier when using tslib with async generators:

If you are using TypeScript 2.3.2 or earlier and are writing async generators, you must use tslib version 1.6.1.
If you are using TypeScript 2.3.3 or later and are writing async generators, you must use tslib version 1.7.0 or later.

But I agree it could be more explicit, perhaps tslib should be an optional peer dependency of typescript? npm/npm#3066

@aluanhaddad
Copy link
Contributor

@frankwallis the peer dependency possibility occurred to me also but I think it may cause more problems than it solves because it rules out multi versioning. Packages depending on different versions of TSlib should be a well supported scenario.

@octogonz
Copy link

octogonz commented Nov 28, 2018

The compatibility between tslib and typescript library versions should be documented at least.

Ideally there should be a way to validate it. We allow people to build bundles using different typescript compilers (sometimes ancient compiler versions, to target compatibility with old product releases). When these bundles are loaded, they can be dynamically linked to the same tslib library. (For example, we might have 30 bundles on our page, so we wouldn't want to load 30 copies of tslib.) If an incompatibility caused a bundle to fail, we wouldn't find out until runtime when someone did something to load that component. If needed, we could dynamically link a bundle to an older tslib to ensure compatibility -- but only if this mapping was actually documented somewhere.

@nickpape-msft

@orta
Copy link
Contributor

orta commented Oct 6, 2020

Coming in late, today we describe the versions of tslib according to their TypeScript versions:

# TypeScript 3.9.2 or later
npm install tslib

# TypeScript 3.8.4 or earlier
npm install tslib@^1

# TypeScript 2.3.2 or earlier
npm install tslib@1.6.1

Is that enough? Or is the answer a table somewhere saying the version which correlated to a release?

@octogonz
Copy link

octogonz commented Oct 7, 2020

Is that enough?

Technically. 👍

Or is the answer a table somewhere saying the version which correlated to a release?

To a casual observer, those three version mappings are so higgledy-piggledy as to raise a quiet doubt whether they are the whole story. Gussying it up with a nice-looking table might help. :-)

@agilgur5
Copy link

Ran into this from jaredpalmer/tsdx#719 (comment) where I could only tell from the Release Notes that tslib@2 was only compatible with TS 3.9+ as there is no peerDep listed. In jaredpalmer/tsdx#904 (comment) I also pointed out that the lack of peerDep also makes it difficult to tell on install/automated dep upgrades whether or not one is compatible, as no peerDep error is printed out.

Is there a way to specify this in a way that is more automated or are we limited to a way that is more manual/user/docs-driven due to #22 (comment) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants