Skip to content

Function#bind/call/apply doesn't return or have same signatures #8129

Description

@falsandtru

TypeScript Version:

master

Code

interface F {
  (): number;
  (p): string;
}
var f: F = (<F>null).bind(null);
var c: number = f.call(null);
var a: number = f.apply(null);

Expected behavior:

$ node built/local/tsc.js index.ts

Actual behavior:

$ node built/local/tsc.js index.ts
index.ts(5,5): error TS2322: Type '(this: void, ...argArray: any[]) => string' i
s not assignable to type 'F'.
  Type 'string' is not assignable to type 'number'.
index.ts(6,5): error TS2322: Type 'string' is not assignable to type 'number'.
index.ts(7,5): error TS2322: Type 'string' is not assignable to type 'number'.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions