mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Move ObjectLiteralPatternWithComputedProperties to ObjectFlags
This commit is contained in:
parent
b37313c90d
commit
58d6156c69
@ -3222,7 +3222,7 @@ namespace ts {
|
||||
result.pattern = pattern;
|
||||
}
|
||||
if (hasComputedProperties) {
|
||||
result.isObjectLiteralPatternWithComputedProperties = true;
|
||||
result.objectFlags |= ObjectFlags.ObjectLiteralPatternWithComputedProperties;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -6734,8 +6734,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function hasExcessProperties(source: FreshObjectLiteralType, target: Type, reportErrors: boolean): boolean {
|
||||
if (maybeTypeOfKind(target, TypeFlags.ObjectType) &&
|
||||
(!(target.flags & TypeFlags.ObjectType) || !(target as ObjectType).isObjectLiteralPatternWithComputedProperties)) {
|
||||
if (maybeTypeOfKind(target, TypeFlags.ObjectType) && !(getObjectFlags(target) & ObjectFlags.ObjectLiteralPatternWithComputedProperties)) {
|
||||
for (const prop of getPropertiesOfObjectType(source)) {
|
||||
if (!isKnownProperty(target, prop.name)) {
|
||||
if (reportErrors) {
|
||||
@ -10599,8 +10598,7 @@ namespace ts {
|
||||
patternWithComputedProperties = true;
|
||||
}
|
||||
}
|
||||
else if (contextualTypeHasPattern &&
|
||||
!(contextualType.flags & TypeFlags.ObjectType && (contextualType as ObjectType).isObjectLiteralPatternWithComputedProperties)) {
|
||||
else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & ObjectFlags.ObjectLiteralPatternWithComputedProperties)) {
|
||||
// If object literal is contextually typed by the implied type of a binding pattern, and if the
|
||||
// binding pattern specifies a default value for the property, make the property optional.
|
||||
const impliedProp = getPropertyOfType(contextualType, member.name);
|
||||
@ -10668,7 +10666,7 @@ namespace ts {
|
||||
result.flags |= TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags);
|
||||
result.objectFlags |= ObjectFlags.ObjectLiteral;
|
||||
if (patternWithComputedProperties) {
|
||||
result.isObjectLiteralPatternWithComputedProperties = true;
|
||||
result.objectFlags |= ObjectFlags.ObjectLiteralPatternWithComputedProperties;
|
||||
}
|
||||
if (inDestructuringPattern) {
|
||||
result.pattern = node;
|
||||
|
||||
@ -2664,6 +2664,7 @@ namespace ts {
|
||||
Instantiated = 1 << 5, // Instantiated anonymous type
|
||||
ObjectLiteral = 1 << 6, // Originates in an object literal
|
||||
EvolvingArray = 1 << 7, // Evolving array type
|
||||
ObjectLiteralPatternWithComputedProperties = 1 << 8, // Object literal pattern with computed properties
|
||||
}
|
||||
|
||||
// Properties common to all types
|
||||
@ -2703,7 +2704,6 @@ namespace ts {
|
||||
// Object types (TypeFlags.ObjectType)
|
||||
export interface ObjectType extends Type {
|
||||
objectFlags: ObjectFlags;
|
||||
isObjectLiteralPatternWithComputedProperties?: boolean;
|
||||
}
|
||||
|
||||
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user