@@ -77,6 +77,7 @@ namespace ts {
77
77
const allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions);
78
78
const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
79
79
const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
80
+ const strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
80
81
const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
81
82
const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
82
83
const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
@@ -463,6 +464,8 @@ namespace ts {
463
464
464
465
let globalObjectType: ObjectType;
465
466
let globalFunctionType: ObjectType;
467
+ let globalCallableFunctionType: ObjectType;
468
+ let globalNewableFunctionType: ObjectType;
466
469
let globalArrayType: GenericType;
467
470
let globalReadonlyArrayType: GenericType;
468
471
let globalStringType: ObjectType;
@@ -7366,8 +7369,12 @@ namespace ts {
7366
7369
if (symbol && symbolIsValue(symbol)) {
7367
7370
return symbol;
7368
7371
}
7369
- if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) {
7370
- const symbol = getPropertyOfObjectType(globalFunctionType, name);
7372
+ const functionType = resolved === anyFunctionType ? globalFunctionType :
7373
+ resolved.callSignatures.length ? globalCallableFunctionType :
7374
+ resolved.constructSignatures.length ? globalNewableFunctionType :
7375
+ undefined;
7376
+ if (functionType) {
7377
+ const symbol = getPropertyOfObjectType(functionType, name);
7371
7378
if (symbol) {
7372
7379
return symbol;
7373
7380
}
@@ -28527,6 +28534,8 @@ namespace ts {
28527
28534
globalArrayType = getGlobalType("Array" as __String, /*arity*/ 1, /*reportErrors*/ true);
28528
28535
globalObjectType = getGlobalType("Object" as __String, /*arity*/ 0, /*reportErrors*/ true);
28529
28536
globalFunctionType = getGlobalType("Function" as __String, /*arity*/ 0, /*reportErrors*/ true);
28537
+ globalCallableFunctionType = strictBindCallApply && getGlobalType("CallableFunction" as __String, /*arity*/ 0, /*reportErrors*/ true) || globalFunctionType;
28538
+ globalNewableFunctionType = strictBindCallApply && getGlobalType("NewableFunction" as __String, /*arity*/ 0, /*reportErrors*/ true) || globalFunctionType;
28530
28539
globalStringType = getGlobalType("String" as __String, /*arity*/ 0, /*reportErrors*/ true);
28531
28540
globalNumberType = getGlobalType("Number" as __String, /*arity*/ 0, /*reportErrors*/ true);
28532
28541
globalBooleanType = getGlobalType("Boolean" as __String, /*arity*/ 0, /*reportErrors*/ true);
0 commit comments