When emitting metadata about type, Use object type if the type cant be resolved

This could be true if expression cannot be resolved resulting in error
This commit is contained in:
Sheetal Nandi
2015-08-24 12:07:14 -07:00
parent 979e2bf7c4
commit 3ca08916d4
7 changed files with 216 additions and 0 deletions

View File

@@ -14409,6 +14409,10 @@ namespace ts {
// Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.
let typeSymbol = resolveEntityName(typeName, SymbolFlags.Type, /*ignoreErrors*/ true);
// We might not be able to resolve type symbol so use unknown type in that case (eg error case)
if (!typeSymbol) {
return TypeReferenceSerializationKind.ObjectType;
}
let type = getDeclaredTypeOfSymbol(typeSymbol);
if (type === unknownType) {
return TypeReferenceSerializationKind.Unknown;