Skip to content

Instantly share code, notes, and snippets.

@cloud-walker
Last active February 28, 2021 06:47
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
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