1
0
Fork 0
mirror of https://github.com/actions/setup-python.git synced 2024-11-22 14:48:36 +00:00
setup-python/node_modules/type-fest
Danny McCormick 39c08a0eaa Initial pass
2019-06-26 21:12:00 -04:00
..
source Initial pass 2019-06-26 21:12:00 -04:00
index.d.ts Initial pass 2019-06-26 21:12:00 -04:00
license Initial pass 2019-06-26 21:12:00 -04:00
package.json Initial pass 2019-06-26 21:12:00 -04:00
readme.md Initial pass 2019-06-26 21:12:00 -04:00



type-fest

A collection of essential TypeScript types



Build Status

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

Usage

import {Omit} from 'type-fest';

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

type FooWithoutRainbow = Omit<Foo, 'rainbow'>;
//=> {unicorn: string}

API

Click the type names for complete docs.

Basic

Utilities

  • Omit - Create a type from an object type without certain keys.
  • Mutable - Convert an object with readonly properties into a mutable object. Inverse of Readonly<T>.
  • Merge - Merge two types into a new type. Keys of the second type overrides keys of the first type.
  • MergeExclusive - Create a type that has mutually exclusive properties.
  • RequireAtLeastOne - Create a type that requires at least one of the given properties.
  • LiteralUnion - Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for Microsoft/TypeScript#29729.

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)