Skip to content

Commit 58d6156

Browse files
committed
Move ObjectLiteralPatternWithComputedProperties to ObjectFlags
1 parent b37313c commit 58d6156

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3222,7 +3222,7 @@ namespace ts {
32223222
result.pattern = pattern;
32233223
}
32243224
if (hasComputedProperties) {
3225-
result.isObjectLiteralPatternWithComputedProperties = true;
3225+
result.objectFlags |= ObjectFlags.ObjectLiteralPatternWithComputedProperties;
32263226
}
32273227
return result;
32283228
}
@@ -6734,8 +6734,7 @@ namespace ts {
67346734
}
67356735

67366736
function hasExcessProperties(source: FreshObjectLiteralType, target: Type, reportErrors: boolean): boolean {
6737-
if (maybeTypeOfKind(target, TypeFlags.ObjectType) &&
6738-
(!(target.flags & TypeFlags.ObjectType) || !(target as ObjectType).isObjectLiteralPatternWithComputedProperties)) {
6737+
if (maybeTypeOfKind(target, TypeFlags.ObjectType) && !(getObjectFlags(target) & ObjectFlags.ObjectLiteralPatternWithComputedProperties)) {
67396738
for (const prop of getPropertiesOfObjectType(source)) {
67406739
if (!isKnownProperty(target, prop.name)) {
67416740
if (reportErrors) {
@@ -10599,8 +10598,7 @@ namespace ts {
1059910598
patternWithComputedProperties = true;
1060010599
}
1060110600
}
10602-
else if (contextualTypeHasPattern &&
10603-
!(contextualType.flags & TypeFlags.ObjectType && (contextualType as ObjectType).isObjectLiteralPatternWithComputedProperties)) {
10601+
else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & ObjectFlags.ObjectLiteralPatternWithComputedProperties)) {
1060410602
// If object literal is contextually typed by the implied type of a binding pattern, and if the
1060510603
// binding pattern specifies a default value for the property, make the property optional.
1060610604
const impliedProp = getPropertyOfType(contextualType, member.name);
@@ -10668,7 +10666,7 @@ namespace ts {
1066810666
result.flags |= TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags);
1066910667
result.objectFlags |= ObjectFlags.ObjectLiteral;
1067010668
if (patternWithComputedProperties) {
10671-
result.isObjectLiteralPatternWithComputedProperties = true;
10669+
result.objectFlags |= ObjectFlags.ObjectLiteralPatternWithComputedProperties;
1067210670
}
1067310671
if (inDestructuringPattern) {
1067410672
result.pattern = node;

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2664,6 +2664,7 @@ namespace ts {
26642664
Instantiated = 1 << 5, // Instantiated anonymous type
26652665
ObjectLiteral = 1 << 6, // Originates in an object literal
26662666
EvolvingArray = 1 << 7, // Evolving array type
2667+
ObjectLiteralPatternWithComputedProperties = 1 << 8, // Object literal pattern with computed properties
26672668
}
26682669

26692670
// Properties common to all types
@@ -2703,7 +2704,6 @@ namespace ts {
27032704
// Object types (TypeFlags.ObjectType)
27042705
export interface ObjectType extends Type {
27052706
objectFlags: ObjectFlags;
2706-
isObjectLiteralPatternWithComputedProperties?: boolean;
27072707
}
27082708

27092709
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)

0 commit comments

Comments
 (0)