Created
December 14, 2018 09:32
-
-
Save ranbena/526ed3fb152ddac5ec4f6eca79bfb0f0 to your computer and use it in GitHub Desktop.
Javascript class interface implements
This file contains hidden or 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
class Foo { | |
on(foo: string) { | |
} | |
} | |
interface IBar { | |
on(foo: 'bar'): void; | |
} | |
class Bar extends Foo implements IBar { | |
on(foo: string) { | |
} | |
} | |
const bar: IBar = new Bar(); | |
bar.on('bar'); //Flow OK | |
bar.on('foo'); // Flow Error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment