JSPM

ts-null-or-undefined

0.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q30607F
  • License ISC

Best type safe way to check null or undefined in typescript

Package Exports

  • ts-null-or-undefined

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ts-null-or-undefined) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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
}