mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
Consider 'object' a valid base type + apparent type of 'object' is {}
This commit is contained in:
@@ -3991,7 +3991,7 @@ namespace ts {
|
||||
// A valid base type is any non-generic object type or intersection of non-generic
|
||||
// object types.
|
||||
function isValidBaseType(type: Type): boolean {
|
||||
return type.flags & TypeFlags.Object && !isGenericMappedType(type) ||
|
||||
return type.flags & (TypeFlags.Object | TypeFlags.NonPrimitive) && !isGenericMappedType(type) ||
|
||||
type.flags & TypeFlags.Intersection && !forEach((<IntersectionType>type).types, t => !isValidBaseType(t));
|
||||
}
|
||||
|
||||
@@ -4944,7 +4944,7 @@ namespace ts {
|
||||
t.flags & TypeFlags.NumberLike ? globalNumberType :
|
||||
t.flags & TypeFlags.BooleanLike ? globalBooleanType :
|
||||
t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType() :
|
||||
t.flags & TypeFlags.NonPrimitive ? globalObjectType :
|
||||
t.flags & TypeFlags.NonPrimitive ? emptyObjectType :
|
||||
t;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user