Skip to content

Instantly share code, notes, and snippets.

@damienstanton
Last active April 17, 2020 16:21
Show Gist options
  • Save damienstanton/5539bf3d235fd06efe4df4de9c6a7acb to your computer and use it in GitHub Desktop.
Save damienstanton/5539bf3d235fd06efe4df4de9c6a7acb to your computer and use it in GitHub Desktop.
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