-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fixed an issue with self-referential awaited union #49677
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
Fixed an issue with self-referential awaited union #49677
Conversation
!!! error TS2322: Type 'SimpleType' is not assignable to type 'T'. | ||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'SimpleType'. | ||
!!! related TS6502 tests/cases/compiler/genericFunctionAgainstUnresolvableSelfReferencingAwaitedUnion.ts:3:20: The expected type comes from the return type of this signature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sending this; do you mind adding the test from #49723 too? Doing so will file the error message this PR adds, in my testing. LGTM, otherwise. |
Thanks for adding the test; did you intend to delete the test from #49646? |
export async function myFunction(param: T1) { | ||
const awaited = await param | ||
~~~~~~~~~~~ | ||
!!! error TS1062: Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jakebailey I've added the test case from your issue - note that the reported error is slightly different from the other one but I assume that's expected (since the other one was specific to generic functions and this ain't one)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct.
Oh, nevermind, it's just one file now. |
fixes #49646