-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Need a means of checking lib
availability.
#40462
Comments
cc @DanielRosenwasser @ahejlsberg ... you might have a quick answer for this one. |
It's not ideal, but you can write |
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow. |
@RyanCavanaugh would we have to add that to the .d.ts manually? It's definitely not ideal. Ideally we'd be able to change what we're doing based off of what lib they're using. This is a problem we have in other places too. In RxJS, we can convert iterables, promises, async iterables, et al, to observables. If they don't support async iterables, ideally we wouldn't have that in the union type we're using. I guess I was looking for something like: type ObservableInput<T> = Observable<T> | Promise<T> | Iterable<T> | (IsDefined<AsyncIterable> ? AsyncIterable<T> : never) ... or something. Haha. I have no idea how it would work. It seems like we can already do so much meta programming in the type system that it's almost possible. |
I'm facing an issue with RxJS where we've moved to support
AsyncIterable
, but if a user compiles a project that uses RxJS with TypeScript and alib
that is less thanES2018
, then the type inference is all messed up becauseAsyncIterable
doesn't exist.lib
requirement on TS users of RxJS?AsyncIterable
exists and "fallback" to other types?lib
s?We have similar issues with trying to accurately type
fromEvent
, etc for both the DOM and Node.Thanks for your time!
The text was updated successfully, but these errors were encountered: