Emit widened literal type for const without type annotation

This commit is contained in:
Anders Hejlsberg
2016-09-24 07:38:26 -07:00
parent b9adef6416
commit 55034d8e10

View File

@@ -18950,7 +18950,7 @@ namespace ts {
// Get type of the symbol if this is the valid symbol otherwise get type at location
const symbol = getSymbolOfNode(declaration);
const type = symbol && !(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.Signature))
? getTypeOfSymbol(symbol)
? getWidenedLiteralType(getTypeOfSymbol(symbol))
: unknownType;
getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);