6
Watch
198
Star
4
Fork
3
Issue

Essential utilities for TypeScript projects

sindresorhus
sindresorhus
pushedAt 1 day ago

sindresorhus/ts-extras

ts-extras npm dependents npm downloads Docs

Essential utilities for TypeScript projects

Still early in development. Ideas for additional essential utilities welcome. Type-only utilities belong in type-fest.

Install

npm install ts-extras

Usage

import {isDefined} from 'ts-extras';

[1, null, 2, undefined].filter(isDefined);
//=> [1, 2]

API

See the source for now. Proper docs will come at some point.

FAQ

What is the difference between this and type-fest?

The type-fest package contains only types, meaning they are only used at compile-time and nothing is ever compiled into actual JavaScript code. This package contains functions that are compiled into JavaScript code and used at runtime.

Related

  • type-fest - A collection of essential TypeScript types
  • is - Type guards for any situation
ucloud ads