mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 02:30:15 -06:00
Only cache types for object literals with 10 or less properties
This commit is contained in:
parent
7118fc5788
commit
28ea53e4f0
@ -13708,10 +13708,10 @@ namespace ts {
|
||||
// We used a cached object literal type if the object literal is not the inferred type of a variable
|
||||
// (otherwise Go To Definition on the variable's members wouldn't work properly), has no methods or
|
||||
// accessors (we may cause circularities when obtaining the types of those members), has no index
|
||||
// signatures, is not in a destructuring pattern, doesn't have more than 50 properties, and doesn't
|
||||
// signatures, is not in a destructuring pattern, doesn't have more than 10 properties, and doesn't
|
||||
// have property names containing colons (which we use as a separator in the cache key).
|
||||
if (!isInferredTypeOfVariable(node) && !hasMethodsOrAccessors && !stringIndexInfo && !numberIndexInfo && !inDestructuringPattern &&
|
||||
propertiesArray.length <= 50 && !forEach(propertiesArray, symbolNameContainsColon)) {
|
||||
propertiesArray.length <= 10 && !forEach(propertiesArray, symbolNameContainsColon)) {
|
||||
return getObjectLiteralType(typeFlags, node.symbol, propertiesTable, propertiesArray);
|
||||
}
|
||||
const result = makeObjectLiteralType(typeFlags, node.symbol, propertiesTable, stringIndexInfo, numberIndexInfo);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user