Last active
February 2, 2022 10:47
-
-
Save Gummiees/3a05de4ccc6ec20da155161f4844fbc9 to your computer and use it in GitHub Desktop.
A TypeScript problem with interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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