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

Impose a minimum TS lib for version 7. #5708

Closed
benlesh opened this issue Sep 9, 2020 · 4 comments
Closed

Impose a minimum TS lib for version 7. #5708

benlesh opened this issue Sep 9, 2020 · 4 comments
Assignees

Comments

@benlesh
Copy link
Member

benlesh commented Sep 9, 2020

Because v7 has interop with AsyncIterable, we need to make sure TS users have a minimum lib setting of es2018.

Issue created for discussion.

Currently, with v7, TypeScript builds targeting ES2017 and under will have issues with typings because ObservableInput<T> includes AyncIterable<T> which isn't available unless you have a lib of ES2018 or greater.

One alternative might be to do some TypeScript type meta-programming to figure out if AyncIterable was available or not.

@benlesh benlesh added AGENDA ITEM Flagged for discussion at core team meetings type: discussion labels Sep 9, 2020
@benlesh
Copy link
Member Author

benlesh commented Sep 9, 2020

Related, it would be great if our esm build was targeting ES2018, however, I don't think we can because the esm build is what Angular uses, and they can't move past ES2015 because of Zones. I've filed an issue for that so it can be tracked: angular/angular#38782

@benlesh
Copy link
Member Author

benlesh commented Sep 9, 2020

Also related: microsoft/TypeScript#40462

@benlesh benlesh assigned benlesh and cartant and unassigned benlesh Oct 7, 2020
@cartant
Copy link
Collaborator

cartant commented Oct 7, 2020

I've had a quick look at this. Adding the triple-slash reference to types.ts - as suggested here - does effect the reference in the generated .d.ts file, so manual manipulation of the .d.ts files is not required.

What we do need to do, though, is figure out just how the lib filenames work. I mean, there is no lib.esnext.asynciterable.d.ts in the TypeScript lib directory, as the type definition for AsyncIterable has not changed since the one that's in lib.es2018.asynciterable.d.ts. So does the lib="esnext.asynciterable" that's in Ryan's comment end up resolving to lib.es2018.asynciterable.d.ts ... 🤷‍♂️

@cartant
Copy link
Collaborator

cartant commented Oct 7, 2020

It seems the value for the lib attribute is what would be passed to the command-line option, so lib="esnext.asynciterable" is exactly what we want.

cartant added a commit to cartant/rxjs that referenced this issue Oct 8, 2020
@cartant cartant removed the AGENDA ITEM Flagged for discussion at core team meetings label Oct 9, 2020
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

2 participants