1
Fork 0

typescript(option): feat: readded the .toString() method on None

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2019-12-23 14:05:26 +02:00 committed by prescientmoon
parent e2e085cbc3
commit d02031e416
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4

View file

@ -6,5 +6,8 @@ type Some<T> = Brand<T, typeof some>
export type Option<T> = Some<T> | None
export const None = { __brand: none } as None
export const None = {
__brand: none,
toString: () => 'None'
} as None
export const Some = <T>(value: T) => value as Option<T>