From 55034d8e103410a6cbd4610c8f50935276db6dda Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 24 Sep 2016 07:38:26 -0700 Subject: [PATCH] Emit widened literal type for const without type annotation --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 01c5642c7d4..54a28528da7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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);