We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
interface Bank { balance: number; withdraw(x: number): number; } class PowellCountyBank implements Bank { balance: number = 0; withdraw(x) { return (this.balance - x); } } var b = new PowellCountyBank(); console.log(b.withdraw({})); // ^ Expect type error here.
(Playground)
The implementation shows the return type of withdraw but not type for the parameter:
withdraw
The text was updated successfully, but these errors were encountered:
Duplicate of #3667. Fix available in #6118.
Sorry, something went wrong.
Actually, #6118 doesn't affect methods, only property initializers. Reopening as suggestion.
Commit 055ae8c from #6118 adds method contextual typing as well. Here's a cut-down sample from the test (it works for extending classes, too):
interface Ringer { ring: (times: number) => void; } class Alarm implements Ringer { str: string; ring(times) { this.str = times; // error } }
No branches or pull requests
(Playground)
The implementation shows the return type of
withdraw
but not type for the parameter:The text was updated successfully, but these errors were encountered: