Fixed an issue with self-referential awaited union#49677
Merged
jakebailey merged 2 commits intomicrosoft:mainfrom Jun 29, 2022
Merged
Fixed an issue with self-referential awaited union#49677jakebailey merged 2 commits intomicrosoft:mainfrom
jakebailey merged 2 commits intomicrosoft:mainfrom
Conversation
Andarist
commented
Jun 24, 2022
Comment on lines
+16
to
+18
| !!! 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. |
Contributor
Author
There was a problem hiding this comment.
Member
|
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. |
Member
|
Thanks for adding the test; did you intend to delete the test from #49646? |
Andarist
commented
Jun 29, 2022
| 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. |
Contributor
Author
There was a problem hiding this comment.
@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)
Member
|
Oh, nevermind, it's just one file now. |
jakebailey
approved these changes
Jun 29, 2022
This was referenced Oct 13, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #49646