mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix crash in getAwaitedType (#52752)
This commit is contained in:
@@ -39028,7 +39028,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
}
|
||||
|
||||
Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
|
||||
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [awaitedTypeCrash.ts]
|
||||
// https://github.com/microsoft/TypeScript/issues/51984
|
||||
async function* f<T extends Promise<never>>(): AsyncGenerator<T, void, void> { }
|
||||
|
||||
//// [awaitedTypeCrash.js]
|
||||
// https://github.com/microsoft/TypeScript/issues/51984
|
||||
async function* f() { }
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/awaitedTypeCrash.ts ===
|
||||
// https://github.com/microsoft/TypeScript/issues/51984
|
||||
async function* f<T extends Promise<never>>(): AsyncGenerator<T, void, void> { }
|
||||
>f : Symbol(f, Decl(awaitedTypeCrash.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(awaitedTypeCrash.ts, 1, 18))
|
||||
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
|
||||
>AsyncGenerator : Symbol(AsyncGenerator, Decl(lib.es2018.asyncgenerator.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(awaitedTypeCrash.ts, 1, 18))
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/awaitedTypeCrash.ts ===
|
||||
// https://github.com/microsoft/TypeScript/issues/51984
|
||||
async function* f<T extends Promise<never>>(): AsyncGenerator<T, void, void> { }
|
||||
>f : <T extends Promise<never>>() => AsyncGenerator<T, void, void>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// @target: esnext
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/51984
|
||||
async function* f<T extends Promise<never>>(): AsyncGenerator<T, void, void> { }
|
||||
Reference in New Issue
Block a user