Skip to content

Instantly share code, notes, and snippets.

@Gummiees
Last active February 2, 2022 10:47
Show Gist options
  • Save Gummiees/3a05de4ccc6ec20da155161f4844fbc9 to your computer and use it in GitHub Desktop.
Save Gummiees/3a05de4ccc6ec20da155161f4844fbc9 to your computer and use it in GitHub Desktop.
A TypeScript problem with interfaces
export interface ExampleInterface {
exampleMethod(result: string): void;
}
export class CorrectExampleClass implements ExampleInterface {
exampleMethod(result: string) {
console.log('This is okay :D');
}
}
export class IncorrectExampleClass implements ExampleInterface {
exampleMethod() {
console.log('This is not okay, but both ESLint and TS say it is :(');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment