@@ -17775,7 +17775,7 @@ namespace ts {
17775
17775
target.flags & TypeFlags.Union ? some((target as UnionType).types, t => isTypeDerivedFrom(source, t)) :
17776
17776
source.flags & TypeFlags.InstantiableNonPrimitive ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) :
17777
17777
target === globalObjectType ? !!(source.flags & (TypeFlags.Object | TypeFlags.NonPrimitive)) :
17778
- target === globalFunctionType ? !!(source.flags & TypeFlags.Object) && isFunctionObjectType(source as ObjectType ) :
17778
+ target === globalFunctionType ? isFunctionObjectType(source) :
17779
17779
hasBaseType(source, getTargetType(target)) || (isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType));
17780
17780
}
17781
17781
@@ -23945,10 +23945,13 @@ namespace ts {
23945
23945
return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
23946
23946
}
23947
23947
23948
- function isFunctionObjectType(type: ObjectType): boolean {
23948
+ function isFunctionObjectType(type: Type): boolean {
23949
+ if (!(type.flags & TypeFlags.StructuredType)) {
23950
+ return false;
23951
+ }
23949
23952
// We do a quick check for a "bind" property before performing the more expensive subtype
23950
23953
// check. This gives us a quicker out in the common case where an object type is not a function.
23951
- const resolved = resolveStructuredTypeMembers(type);
23954
+ const resolved = resolveStructuredTypeMembers(type as StructuredType );
23952
23955
return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
23953
23956
resolved.members.get("bind" as __String) && isTypeSubtypeOf(type, globalFunctionType));
23954
23957
}
@@ -23996,7 +23999,7 @@ namespace ts {
23996
23999
if (flags & TypeFlags.Object) {
23997
24000
return getObjectFlags(type) & ObjectFlags.Anonymous && isEmptyObjectType(type as ObjectType) ?
23998
24001
strictNullChecks ? TypeFacts.EmptyObjectStrictFacts : TypeFacts.EmptyObjectFacts :
23999
- isFunctionObjectType(type as ObjectType ) ?
24002
+ isFunctionObjectType(type) ?
24000
24003
strictNullChecks ? TypeFacts.FunctionStrictFacts : TypeFacts.FunctionFacts :
24001
24004
strictNullChecks ? TypeFacts.ObjectStrictFacts : TypeFacts.ObjectFacts;
24002
24005
}
@@ -34629,7 +34632,7 @@ namespace ts {
34629
34632
declKind !== AssignmentDeclarationKind.ModuleExports &&
34630
34633
declKind !== AssignmentDeclarationKind.Prototype &&
34631
34634
!isEmptyObjectType(rightType) &&
34632
- !isFunctionObjectType(rightType as ObjectType ) &&
34635
+ !isFunctionObjectType(rightType) &&
34633
34636
!(getObjectFlags(rightType) & ObjectFlags.Class)) {
34634
34637
// don't check assignability of module.exports=, C.prototype=, or expando types because they will necessarily be incomplete
34635
34638
checkAssignmentOperator(rightType);
0 commit comments