Last active
April 17, 2020 16:21
-
-
Save damienstanton/5539bf3d235fd06efe4df4de9c6a7acb to your computer and use it in GitHub Desktop.
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
interface Trait { | |
// some props | |
} | |
export default class Foo implements Trait { | |
private static foo: Foo | |
private constructor() { } | |
static instance(): Foo { | |
if (this.foo == null) this.foo = new Foo() | |
return this.foo | |
} | |
// methods that satisfy Trait | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment