Skip to content

Commit 86b3c14

Browse files
committed
Consider 'object' a valid base type + apparent type of 'object' is {}
1 parent 207f1aa commit 86b3c14

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3991,7 +3991,7 @@ namespace ts {
39913991
// A valid base type is any non-generic object type or intersection of non-generic
39923992
// object types.
39933993
function isValidBaseType(type: Type): boolean {
3994-
return type.flags & TypeFlags.Object && !isGenericMappedType(type) ||
3994+
return type.flags & (TypeFlags.Object | TypeFlags.NonPrimitive) && !isGenericMappedType(type) ||
39953995
type.flags & TypeFlags.Intersection && !forEach((<IntersectionType>type).types, t => !isValidBaseType(t));
39963996
}
39973997

@@ -4944,7 +4944,7 @@ namespace ts {
49444944
t.flags & TypeFlags.NumberLike ? globalNumberType :
49454945
t.flags & TypeFlags.BooleanLike ? globalBooleanType :
49464946
t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType() :
4947-
t.flags & TypeFlags.NonPrimitive ? globalObjectType :
4947+
t.flags & TypeFlags.NonPrimitive ? emptyObjectType :
49484948
t;
49494949
}
49504950

0 commit comments

Comments
 (0)