Skip to content

Use base constraint when testing whether a type needs an Awaited<T> wrapper - #51230

Merged
Ron Buckton (rbuckton) merged 1 commit into
mainfrom
fix47291
Oct 21, 2022
Merged

Use base constraint when testing whether a type needs an Awaited<T> wrapper#51230
Ron Buckton (rbuckton) merged 1 commit into
mainfrom
fix47291

Conversation

@rbuckton

Copy link
Copy Markdown
Contributor

When we updated await to use Awaited<T> in 4.5, we avoided introducing a new Awaited<T> wrapper when T is a generic primitive by calling allTypesAssignableToKind. However, when T is a this type, it triggers a circularity error. This change ensures we check against the base constraint of T rather than T itself, which avoids the circularity.

Fixes #47291

@typescript-bot TypeScript Bot (typescript-bot) added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Oct 19, 2022
@rbuckton Ron Buckton (rbuckton) changed the title Include this type parameter in isRelatedTo fast path Use base constraint when testing whether a type needs an Awaited<T> wrapper Oct 19, 2022
@rbuckton
Ron Buckton (rbuckton) merged commit a56b254 into main Oct 21, 2022
@rbuckton
Ron Buckton (rbuckton) deleted the fix47291 branch October 21, 2022 12:00
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Async methods that return this are considered circular references

4 participants