Skip to content

Commit

Permalink
fix(maybe): fix the order of overloadings of from and its alias (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ailrun committed Aug 22, 2018
1 parent ae02c10 commit aaf1144
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/maybe/src/Maybe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ export namespace Maybe {
}
export const of = unit;

export function from(value?: null): Nothing<any>;
export function from<T>(value: T): Just<T>;
export function from<T>(value?: null): Nothing<T>;
export function from<T>(value?: T | null): Maybe<T> {
if (value == undefined) {
return new Nothing();
Expand All @@ -179,11 +179,7 @@ export namespace Maybe {
return new Just(value);
}

export function maybe<T>(value: T): Just<T>;
export function maybe<T>(value?: null): Nothing<T>;
export function maybe<T>(value?: T | null): Maybe<T> {
return from<T>(value as any);
}
export const maybe = from;

export function sequenceObject<O extends object>(
obj: { [K in keyof O]: Maybe<O[K]> },
Expand Down

0 comments on commit aaf1144

Please sign in to comment.