ts-null-or-undefined
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

ts-null-or-undefined

Best way to check for null or undefined in typescript using a type guard. Can strip out null or undefine or complex types like T | null etc.

To use:

import Type from "ts-null-or-undefined";
 
let a: number | null = 0;
 
console.log(a*4); //Error: a might be null
 
if(!Type.isNullOrUndefined(a)){
    console.log(a*4); //Works
}

Readme

Keywords

none

Package Sidebar

Install

npm i ts-null-or-undefined

Weekly Downloads

2

Version

0.0.5

License

ISC

Last publish

Collaborators

  • naqvitalha