Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24259,7 +24259,7 @@ namespace ts {
const thisType = getThisTypeOfSignature(signature);
if (thisType) {
const thisArgumentNode = getThisArgumentOfCall(node);
const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;
const thisArgumentType = thisArgumentNode ? checkExpressionWithContextualType(thisArgumentNode, thisType, context, checkMode) : voidType;
inferTypes(context.inferences, thisArgumentType, thisType);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests/cases/compiler/genericFunctionInference1.ts(135,14): error TS2345: Argument of type '<a>(value: { key: a; }) => a' is not assignable to parameter of type '(value: Data) => string'.
tests/cases/compiler/genericFunctionInference1.ts(137,14): error TS2345: Argument of type '<a>(value: { key: a; }) => a' is not assignable to parameter of type '(value: Data) => string'.
Type 'number' is not assignable to type 'string'.


Expand Down Expand Up @@ -114,6 +114,8 @@ tests/cases/compiler/genericFunctionInference1.ts(135,14): error TS2345: Argumen

const GenericComp2 = myHoc(GenericComp);

const l: string[] = list.call(undefined, "");

// #417

function mirror<A, B>(f: (a: A) => B): (a: A) => B { return f; }
Expand Down
3 changes: 3 additions & 0 deletions tests/baselines/reference/genericFunctionInference1.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ declare class GenericComp<T> extends Comp<GenericProps<T>> {}

const GenericComp2 = myHoc(GenericComp);

const l: string[] = list.call(undefined, "");

// #417

function mirror<A, B>(f: (a: A) => B): (a: A) => B { return f; }
Expand Down Expand Up @@ -301,6 +303,7 @@ const p2 = newPoint(10, 20);
const bag1 = new Bag(1, 2, 3);
const bag2 = newBag('a', 'b', 'c');
const GenericComp2 = myHoc(GenericComp);
const l = list.call(undefined, "");
// #417
function mirror(f) { return f; }
var identityM = mirror(identity);
Expand Down
Loading