Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-unstable-api-use: better handling of uncalled function with deprecated overload #725

Open
ajafff opened this issue Dec 20, 2020 · 0 comments

Comments

@ajafff
Copy link
Member

ajafff commented Dec 20, 2020

/**@deprecated Use the other overload instead.*/
function baz(): string;
function baz(v: string): string;
function baz(...args: string[]) {return args[0];}

baz; // should be no error
setTimeout(baz, 1000); // should be an error

declare function takeNoArgsCb(cb: () => any): void;
declare function takeStringArgCb(cb: (v: string) => any): void;

takeNoArgsCb(baz); // should be an error
takeStringArgCb(baz); // no error if feasible

Proposal: only report uncalled function if it has a contextual type with call signature. The same probably applies to constructor types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant