Added shortcut in checkAwaitedType for isolatedModules

This commit is contained in:
Ron Buckton
2015-06-18 15:41:19 -07:00
parent 379d74a1bf
commit eb03ae8e7c
4 changed files with 211 additions and 0 deletions
+6
View File
@@ -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));