mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-17 21:09:09 -05:00
Fixed an issue with self-referential awaited union (#49677)
This commit is contained in:
committed by
GitHub
parent
52f4055174
commit
bd11ce2aeb
@@ -36625,8 +36625,20 @@ namespace ts {
|
||||
|
||||
// For a union, get a union of the awaited types of each constituent.
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
||||
if (errorNode) {
|
||||
error(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const mapper = errorNode ? (constituentType: Type) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0) : getAwaitedTypeNoAlias;
|
||||
return typeAsAwaitable.awaitedTypeOfType = mapType(type, mapper);
|
||||
|
||||
awaitedTypeStack.push(type.id);
|
||||
const mapped = mapType(type, mapper);
|
||||
awaitedTypeStack.pop();
|
||||
|
||||
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
||||
}
|
||||
|
||||
const thisTypeForErrorOut: { value: Type | undefined } = { value: undefined };
|
||||
|
||||
Reference in New Issue
Block a user