@@ -134,16 +134,16 @@ namespace ts {
134
134
const neverType = createIntrinsicType(TypeFlags.Never, "never");
135
135
const silentNeverType = createIntrinsicType(TypeFlags.Never, "never");
136
136
137
- const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined, undefined );
138
- const emptyGenericType = <GenericType><ObjectType>createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined, undefined );
137
+ const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
138
+ const emptyGenericType = <GenericType><ObjectType>createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
139
139
emptyGenericType.instantiations = createMap<TypeReference>();
140
140
141
- const anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined, undefined );
141
+ const anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
142
142
// The anyFunctionType contains the anyFunctionType by definition. The flag is further propagated
143
143
// in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes.
144
144
anyFunctionType.flags |= TypeFlags.ContainsAnyFunctionType;
145
145
146
- const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined, undefined );
146
+ const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
147
147
148
148
const anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
149
149
const unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
@@ -1618,12 +1618,9 @@ namespace ts {
1618
1618
return <ResolvedType>type;
1619
1619
}
1620
1620
1621
- function createAnonymousType(symbol: Symbol, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], stringIndexInfo: IndexInfo, numberIndexInfo: IndexInfo, isObjectLiteral: boolean): ResolvedType {
1622
- const t = createObjectType(TypeFlags.Anonymous, symbol);
1623
- if (isObjectLiteral) {
1624
- t.isObjectLiteral = true;
1625
- }
1626
- return setObjectTypeMembers(t, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);
1621
+ function createAnonymousType(symbol: Symbol, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], stringIndexInfo: IndexInfo, numberIndexInfo: IndexInfo): ResolvedType {
1622
+ return setObjectTypeMembers(createObjectType(TypeFlags.Anonymous, symbol),
1623
+ members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);
1627
1624
}
1628
1625
1629
1626
function forEachSymbolTableInScope<T>(enclosingDeclaration: Node, callback: (symbolTable: SymbolTable) => T): T {
@@ -3176,7 +3173,7 @@ namespace ts {
3176
3173
symbol.bindingElement = e;
3177
3174
members[symbol.name] = symbol;
3178
3175
});
3179
- const result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined, undefined );
3176
+ const result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined);
3180
3177
if (includePatternInType) {
3181
3178
result.pattern = pattern;
3182
3179
}
@@ -6477,7 +6474,7 @@ namespace ts {
6477
6474
6478
6475
if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return Ternary.True;
6479
6476
6480
- if (source.flags & TypeFlags.ObjectType && (source as ObjectType).isObjectLiteral && source.flags & TypeFlags.FreshLiteral) {
6477
+ if (source.flags & TypeFlags.ObjectLiteral && source.flags & TypeFlags.FreshLiteral) {
6481
6478
if (hasExcessProperties(<FreshObjectLiteralType>source, target, reportErrors)) {
6482
6479
if (reportErrors) {
6483
6480
reportRelationError(headMessage, source, target);
@@ -6846,7 +6843,7 @@ namespace ts {
6846
6843
}
6847
6844
let result = Ternary.True;
6848
6845
const properties = getPropertiesOfObjectType(target);
6849
- const requireOptionalProperties = relation === subtypeRelation && !(source.flags & TypeFlags.ObjectType && (source as ObjectType).isObjectLiteral );
6846
+ const requireOptionalProperties = relation === subtypeRelation && !(source.flags & TypeFlags.ObjectLiteral );
6850
6847
for (const targetProp of properties) {
6851
6848
const sourceProp = getPropertyOfType(source, targetProp.name);
6852
6849
@@ -7485,7 +7482,7 @@ namespace ts {
7485
7482
* Leave signatures alone since they are not subject to the check.
7486
7483
*/
7487
7484
function getRegularTypeOfObjectLiteral(type: Type): Type {
7488
- if (!(type.flags & TypeFlags.ObjectType && (type as ObjectType).isObjectLiteral && type.flags & TypeFlags.FreshLiteral)) {
7485
+ if (!(type.flags & TypeFlags.ObjectLiteral && type.flags & TypeFlags.FreshLiteral)) {
7489
7486
return type;
7490
7487
}
7491
7488
const regularType = (<FreshObjectLiteralType>type).regularType;
@@ -7500,8 +7497,7 @@ namespace ts {
7500
7497
resolved.callSignatures,
7501
7498
resolved.constructSignatures,
7502
7499
resolved.stringIndexInfo,
7503
- resolved.numberIndexInfo,
7504
- resolved.isObjectLiteral);
7500
+ resolved.numberIndexInfo);
7505
7501
regularNew.flags = resolved.flags & ~TypeFlags.FreshLiteral;
7506
7502
(<FreshObjectLiteralType>type).regularType = regularNew;
7507
7503
return regularNew;
@@ -7516,8 +7512,7 @@ namespace ts {
7516
7512
const numberIndexInfo = getIndexInfoOfType(type, IndexKind.Number);
7517
7513
return createAnonymousType(type.symbol, members, emptyArray, emptyArray,
7518
7514
stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly),
7519
- numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly),
7520
- (type as ObjectType).isObjectLiteral);
7515
+ numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly));
7521
7516
}
7522
7517
7523
7518
function getWidenedConstituentType(type: Type): Type {
@@ -7529,8 +7524,7 @@ namespace ts {
7529
7524
if (type.flags & TypeFlags.Nullable) {
7530
7525
return anyType;
7531
7526
}
7532
- // if (type.flags & TypeFlags.ObjectLiteral) {
7533
- if (type.flags & TypeFlags.ObjectType && (type as ObjectType).isObjectLiteral) {
7527
+ if (type.flags & TypeFlags.ObjectLiteral) {
7534
7528
return getWidenedTypeOfObjectLiteral(type);
7535
7529
}
7536
7530
if (type.flags & TypeFlags.Union) {
@@ -7570,7 +7564,7 @@ namespace ts {
7570
7564
}
7571
7565
}
7572
7566
}
7573
- if (type.flags & TypeFlags.ObjectType && (type as ObjectType).isObjectLiteral ) {
7567
+ if (type.flags & TypeFlags.ObjectLiteral ) {
7574
7568
for (const p of getPropertiesOfObjectType(type)) {
7575
7569
const t = getTypeOfSymbol(p);
7576
7570
if (t.flags & TypeFlags.ContainsWideningType) {
@@ -10379,7 +10373,7 @@ namespace ts {
10379
10373
10380
10374
const stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, IndexKind.String) : undefined;
10381
10375
const numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, IndexKind.Number) : undefined;
10382
- const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo, /*isObjectLiteral*/ true );
10376
+ const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
10383
10377
const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshLiteral;
10384
10378
result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags);
10385
10379
if (patternWithComputedProperties) {
@@ -12492,7 +12486,7 @@ namespace ts {
12492
12486
function getInferredClassType(symbol: Symbol) {
12493
12487
const links = getSymbolLinks(symbol);
12494
12488
if (!links.inferredClassType) {
12495
- links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined, /*isObjectLiteral*/ undefined );
12489
+ links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
12496
12490
}
12497
12491
return links.inferredClassType;
12498
12492
}
0 commit comments