typeof x === "function" type guards include Function interface

This commit is contained in:
Anders Hejlsberg 2016-04-18 16:58:22 -07:00
parent 9defdde02f
commit d28a4feeba

View file

@ -7366,7 +7366,7 @@ namespace ts {
}
if (flags & TypeFlags.ObjectType) {
const resolved = resolveStructuredTypeMembers(type);
return resolved.callSignatures.length || resolved.constructSignatures.length ?
return resolved.callSignatures.length || resolved.constructSignatures.length || isTypeSubtypeOf(type, globalFunctionType) ?
strictNullChecks ? TypeFacts.FunctionStrictFacts : TypeFacts.FunctionFacts :
strictNullChecks ? TypeFacts.ObjectStrictFacts : TypeFacts.ObjectFacts;
}