We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad1c9b9 commit b9fa0afCopy full SHA for b9fa0af
src/compiler/checker.ts
@@ -3094,7 +3094,7 @@ namespace ts {
3094
// Use the type of the initializer expression if one is present
3095
if (declaration.initializer) {
3096
const exprType = checkExpressionCached(declaration.initializer);
3097
- const type = getCombinedModifierFlags(declaration) & (ModifierFlags.Const | ModifierFlags.Readonly) ? exprType : getBaseTypeOfLiteralType(exprType);
+ const type = getCombinedNodeFlags(declaration) & NodeFlags.Const || getCombinedModifierFlags(declaration) & ModifierFlags.Readonly ? exprType : getBaseTypeOfLiteralType(exprType);
3098
return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality);
3099
}
3100
0 commit comments