Skip to content

Commit

Permalink
fix: make TS happy without needing '@ts-ignore'
Browse files Browse the repository at this point in the history
  • Loading branch information
andy.patterson authored and andnp committed Apr 29, 2018
1 parent 700e1c3 commit d6814a9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/none.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ export default class None<T> extends Maybe<T> {

static none<T>() { return new None<T>(); }

expect(msg?: string | Error) {
expect(msg?: string | Error): T {
if (msg instanceof Error) throw msg;
throw new Error(msg || 'Expected Maybe to contain non-null value');

// @ts-ignore -- need to return type T, but this is unreachable code
return this.value!;
}

caseOf<R>(funcs: MatchType<T, R>): Maybe<R> {
Expand Down

0 comments on commit d6814a9

Please sign in to comment.