Skip to content

Instantly share code, notes, and snippets.

Last active February 28, 2021 06:47
What would you like to do?
TypeScript utils
export type Nully = null | undefined
export type Falsy = false | 0 | '' | Nully
import {Nully} from './common.ts'
export const isNotNully = <T>(value: T): value is Exclude<T, Nully> => value != null && value != undefined
import {Falsy} from './common.ts'
export const isTruthy = <T>(value: T): value is Exclude<T, Falsy> => !!value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment