Created
November 27, 2019 03:26
-
-
Save reggi/5f26649bc7e525a2a9f534b91ae2fa8b 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
export function ServiceState<G>(): new () => { value?: G, set(type: G): G } | |
export function ServiceState<G>(type: G): new () => { value: G, set(type: G): G } | |
export function ServiceState<G>(type?: G) { | |
return class ServiceState { | |
value: G | undefined | |
constructor() { | |
this.value = type | |
} | |
set(type: G) { | |
this.value = type | |
return type | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment