Skip to content

Commit 62ac294

Browse files
committed
Higher order this parameter inference, like microsoft#31116
1 parent d3855d6 commit 62ac294

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23725,7 +23725,7 @@ namespace ts {
2372523725
const thisType = getThisTypeOfSignature(signature);
2372623726
if (thisType) {
2372723727
const thisArgumentNode = getThisArgumentOfCall(node);
23728-
const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;
23728+
const thisArgumentType = thisArgumentNode ? checkExpressionWithContextualType(thisArgumentNode, thisType, context, checkMode) : voidType;
2372923729
inferTypes(context.inferences, thisArgumentType, thisType);
2373023730
}
2373123731

tests/baselines/reference/user/create-react-app.log

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Exit Code: 1
22
Standard output:
3-
test/fixtures/issue-5176-flow-class-properties/src/App.js(5,8): error TS8010: 'types' can only be used in a .ts file.
3+
test/fixtures/issue-5176-flow-class-properties/src/App.js(5,8): error TS8010: Type annotations can only be used in TypeScript files.
44
test/fixtures/issue-5176-flow-class-properties/src/App.js(5,13): error TS1005: ';' expected.
55
test/fixtures/webpack-message-formatting/src/AppBabel.js(6,8): error TS17008: JSX element 'div' has no corresponding closing tag.
66
test/fixtures/webpack-message-formatting/src/AppBabel.js(8,7): error TS17002: Expected corresponding JSX closing tag for 'span'.

tests/baselines/reference/user/npm.log

+8
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,14 @@ node_modules/npm/lib/whoami.js(18,18): error TS2339: Property 'config' does not
925925
node_modules/npm/lib/whoami.js(24,18): error TS2339: Property 'registry' does not exist on type 'typeof EventEmitter'.
926926
node_modules/npm/lib/whoami.js(30,26): error TS2339: Property 'code' does not exist on type 'Error'.
927927
node_modules/npm/lib/whoami.js(45,12): error TS2339: Property 'code' does not exist on type 'Error'.
928+
node_modules/npm/scripts/index-build.js(20,13): error TS2531: Object is possibly 'null'.
929+
node_modules/npm/scripts/index-build.js(20,22): error TS2531: Object is possibly 'null'.
930+
node_modules/npm/scripts/index-build.js(21,30): error TS2531: Object is possibly 'null'.
931+
node_modules/npm/scripts/index-build.js(22,29): error TS2531: Object is possibly 'null'.
932+
node_modules/npm/scripts/index-build.js(23,15): error TS2531: Object is possibly 'null'.
933+
node_modules/npm/scripts/index-build.js(23,22): error TS2531: Object is possibly 'null'.
934+
node_modules/npm/scripts/index-build.js(24,15): error TS2531: Object is possibly 'null'.
935+
node_modules/npm/scripts/index-build.js(24,22): error TS2531: Object is possibly 'null'.
928936
node_modules/npm/scripts/publish-tag.js(2,36): error TS2732: Cannot find module '../package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension
929937
node_modules/npm/test/broken-under-nyc-and-travis/lifecycle-path.js(7,20): error TS2307: Cannot find module 'tap'.
930938
node_modules/npm/test/broken-under-nyc-and-travis/lifecycle-path.js(18,23): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.

0 commit comments

Comments
 (0)