TypeScript Version: 3.3.0-dev.20181207
Search Terms: bind generic strict
Code
classSomeClass{constructor(){this.genericMethod=this.genericMethod.bind(this);// TS2322: Type '(callback: (p: {}) => {}) => void' is not// assignable to type '<T>(callback: (p: T) => T) => void':this.genericWithCallback=this.genericWithCallback.bind(this);}genericMethod<T>(p: T): void{}genericWithCallback<T>(callback: (p: T)=>T): void{}}Compile with tsc TypeScriptIssue.ts --target es6 --strictBindCallApply
Expected behavior:
No compile error
Actual behavior:
error TS2322: Type '(callback: (p: {}) => {}) => void' is not assignable to type '<T>(callback: (p: T) => T) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'p' and 'p' are incompatible.
Type '{}' is not assignable to type 'T'.
Playground Link: (no --strictBindCallApply flag available)
Related issues:
TypeScript Version: 3.3.0-dev.20181207
Search Terms: bind generic strict
Code
Compile with
tsc TypeScriptIssue.ts --target es6 --strictBindCallApplyExpected behavior:
No compile error
Actual behavior:
Playground Link: (no --strictBindCallApply flag available)
Related issues: