Readonly properties in classes are considered immutable locations
This commit is contained in:
parent
b3c9571d6f
commit
6ae71cb7ed
1 changed files with 1 additions and 1 deletions
|
@ -3086,7 +3086,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 ? exprType : getBaseTypeOfLiteralType(exprType);
|
||||
const type = getCombinedNodeFlags(declaration) & (NodeFlags.Const | NodeFlags.Readonly) ? exprType : getBaseTypeOfLiteralType(exprType);
|
||||
return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue