diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 50ce298d2d7..a7daeed2459 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3094,7 +3094,7 @@ namespace ts { // Use the type of the initializer expression if one is present if (declaration.initializer) { const exprType = checkExpressionCached(declaration.initializer); - const type = getCombinedNodeFlags(declaration) & (NodeFlags.Const | NodeFlags.Readonly) ? exprType : getBaseTypeOfLiteralType(exprType); + const type = getCombinedModifierFlags(declaration) & (ModifierFlags.Const | ModifierFlags.Readonly) ? exprType : getBaseTypeOfLiteralType(exprType); return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality); }