type-fest

A collection of essential TypeScript types



Sindre Sorhus' open source work is supported by the community

Special thanks to:





npm dependents npm downloads

Many of the types here should have been built-in. You can help by suggesting some of them to the TypeScript project.

Either add this package as a dependency or copy-paste the needed types. No credit required. 👌

PR welcome for additional commonly needed types and docs improvements. Read the contributing guidelines first.

Install

$ npm install type-fest

Requires TypeScript >=3.4

Usage

```ts import {Except} from 'type-fest';

type Foo = { unicorn: string; rainbow: boolean; };

type FooWithoutRainbow = Except; //=> {unicorn: string} ```

API

Click the type names for complete docs.

Basic

Utilities

Template literal types

Note: These require TypeScript 4.1 or newer.

Miscellaneous

Declined types

If we decline a type addition, we will make sure to document the better solution here.

Tips

Built-in types

There are many advanced types most users don't know about.

You can find some examples in the TypeScript docs.

Maintainers

License

(MIT OR CC0-1.0)


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.