typescript(option): feat: readded the .toString() method on None
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
e2e085cbc3
commit
d02031e416
|
@ -6,5 +6,8 @@ type Some<T> = Brand<T, typeof some>
|
||||||
|
|
||||||
export type Option<T> = Some<T> | None
|
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>
|
export const Some = <T>(value: T) => value as Option<T>
|
||||||
|
|
Loading…
Reference in a new issue