microsoft / vscode-typescript-tslint-plugin

VS Code extension that provides TSLint support using the typescript-tslint-plugin
https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin
MIT License
189 stars 34 forks source link

Question about generic #102

Closed cqh963852 closed 5 years ago

cqh963852 commented 5 years ago
function Test<T>(fn: (a: T) => void, a: T): void;

function Test(fn: () => void): void;

function Test(fn: any, a?: any) {
  if(a!=null){
    fn(a);
  }else{
    fn();
  }
}

function fun() {}

const a = 1;

Test(fun,a);

The fun function is ()=>void but The tslint won't tell me fun is not assign to (a:T)=>void image

mjbvz commented 5 years ago

This sounds like a regular TS question, not a tslint issue.

Please ask this on StackOverflow or file an issue against TypeScript