mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Remove readonly from index signatures of a spread
This commit is contained in:
parent
8d5b0529b2
commit
db9ed00a0f
@ -7993,11 +7993,16 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
const spread = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
|
||||
const spread = createAnonymousType(
|
||||
symbol,
|
||||
members,
|
||||
emptyArray,
|
||||
emptyArray,
|
||||
getNonReadonlyIndexSignature(stringIndexInfo),
|
||||
getNonReadonlyIndexSignature(numberIndexInfo));
|
||||
spread.flags |= propagatedFlags;
|
||||
spread.flags |= TypeFlags.FreshLiteral | TypeFlags.ContainsObjectLiteral;
|
||||
(spread as ObjectType).objectFlags |= (ObjectFlags.ObjectLiteral | ObjectFlags.ContainsSpread);
|
||||
spread.symbol = symbol;
|
||||
return spread;
|
||||
}
|
||||
|
||||
@ -8013,6 +8018,13 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getNonReadonlyIndexSignature(index: IndexInfo) {
|
||||
if (index && index.isReadonly) {
|
||||
return createIndexInfo(index.type, /*isReadonly*/ false, index.declaration);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
function isClassMethod(prop: Symbol) {
|
||||
return prop.flags & SymbolFlags.Method && find(prop.declarations, decl => isClassLike(decl.parent));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user