mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Added shortcut in checkAwaitedType for isolatedModules
This commit is contained in:
@@ -9687,6 +9687,12 @@ namespace ts {
|
||||
// side of the `Promise` class, which would be `{ new <T>(...): Promise<T> }`.
|
||||
|
||||
let promiseType = getTypeFromTypeNode(node.type);
|
||||
if (promiseType === unknownType && compilerOptions.isolatedModules) {
|
||||
// If we are compiling with isolatedModules, we may not be able to resolve the
|
||||
// type as a value. As such, we will just return unknownType;
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
let promiseConstructor = getMergedSymbol(promiseType.symbol);
|
||||
if (!promiseConstructor || !symbolIsValue(promiseConstructor)) {
|
||||
error(node, Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType));
|
||||
|
||||
Reference in New Issue
Block a user