kibana/packages/kbn-utility-types
Tyler Smalley c16480e849
[7.x][DX] Upgrade prettier to v2.4.0 (#112359) (#112524)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-09-19 22:34:46 -07:00
..
jest chore(NA): moving @kbn/utility-types to babel transpiler (#107159) (#107320) 2021-07-30 17:05:52 -04:00
src [7.x][DX] Upgrade prettier to v2.4.0 (#112359) (#112524) 2021-09-19 22:34:46 -07:00
BUILD.bazel [build_ts_refs] improve caches, allow building a subset of projects (#107981) (#108139) 2021-08-11 05:08:54 -04:00
package.json chore(NA): moving @kbn/utility-types to babel transpiler (#107159) (#107320) 2021-07-30 17:05:52 -04:00
README.md
tsconfig.json [build_ts_refs] improve caches, allow building a subset of projects (#107981) (#108139) 2021-08-11 05:08:54 -04: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.