kibana/packages/kbn-utility-types
Spencer 07c1284e9d
[kbn/bootstrap] validate that certain deps don't ship in production (#80549)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2020-10-15 09:56:10 -07:00
..
test-d Bump yargs-parser to v13.1.2+ (#77009) 2020-09-14 10:49:15 +02:00
index.ts Extract src/core in a separate TS project (#76785) 2020-09-15 12:41:27 +02:00
package.json [kbn/bootstrap] validate that certain deps don't ship in production (#80549) 2020-10-15 09:56:10 -07:00
README.md [resubmit] Prep agg types for new platform (#58893) 2020-02-28 11:15:43 -07:00
tsconfig.json Extract src/core in a separate TS project (#76785) 2020-09-15 12:41:27 +02:00
yarn.lock Add lockfile symlinks (#55440) 2020-01-27 11:38:20 -05:00

@kbn/utility-types

TypeScript utility types for usage in Kibana.

  • This package re-exports a subset of the items in utility-types
  • You can also add more utility types here.

Usage

import { UnwrapPromise } from '@kbn/utility-types';

type A = Promise<string>;
type B = UnwrapPromise<A>; // string

Reference

  • Assign<T, U> — From U assign properties to T (just like object assign).
  • Ensure<T, X> — Makes sure T is of type X.
  • ObservableLike<T> — Minimal interface for an object resembling an Observable.
  • PublicContract<T> — Returns an object with public keys only.
  • PublicKeys<T> — Returns public keys of an object.
  • RecursiveReadonly<T> — Like Readonly<T>, but freezes object recursively.
  • ShallowPromise<T> — Same as Promise type, but it flat maps the wrapped type.
  • UnionToIntersection<T> — Converts a union of types into an intersection.
  • UnwrapObservable<T> — Returns wrapped type of an observable.
  • UnwrapPromise<T> — Returns wrapped type of a promise.
  • UnwrapPromiseOrReturn<T> — Returns wrapped type of a promise or the type itself, if it isn't a promise.
  • Values<T> — Returns object or array value types.