Skip to content

Commit

Permalink
Fixed null type resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Antoci committed Jan 22, 2021
1 parent c53a7c9 commit d0c570b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/maybe/maybe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import equal from 'fast-deep-equal/es6/react'
import { once } from '../lambda'
import { createAdtBuilder } from '../utils/adt-builder'
import { Just, JustValueOrMaybe, Maybe, None } from './maybe.types'
import { createSerializer } from "../utils/serializer";
import { createSerializer } from '../utils/serializer'

const builder = createAdtBuilder({})

Expand All @@ -24,7 +24,8 @@ export const just = <A>(value: NonNullable<JustValueOrMaybe<A>>): Maybe<A> =>
})
)

const VOID = (() => {})()
const VOID = (() => {
})()

export const none = once(
<A = [Error, 'Please specify type in none']>(): Maybe<A> =>
Expand Down Expand Up @@ -55,4 +56,4 @@ const isNonNullable = <T>(data: T): data is NonNullable<T> => {
}
}

export const maybe = <A>(value?: JustValueOrMaybe<A>): Maybe<A> => (isNonNullable(value) ? just(value) : none())
export const maybe = <A>(value?: JustValueOrMaybe<A> | null): Maybe<A> => (isNonNullable(value) ? just(value) : none())

0 comments on commit d0c570b

Please sign in to comment.