kibana/packages/kbn-utility-types
Vadim Dalecky e80611483f
State containers (#52384)
* feat: 🎸 add state containers

* docs: ✏️ add state container demos

* docs: ✏️ refrech state container docs

* chore: 🤖 install default comparator

* chore: 🤖 remove old state container implementation

* feat: 🎸 add selectors

* chore: 🤖 move Ensure tyep to type utils

* fix: 🐛 fix useSelector() types and demo CLI command

* test: 💍 add tests for state container demos

* feat: 🎸 add ReacursiveReadonly to kbn-utility-types

* feat: 🎸 shallow freeze state when not in production

* test: 💍 fix Jest tests

* refactor: 💡 remove .state and use BehaviourSubject
2019-12-06 10:53:06 -08:00
..
test-d
index.ts State containers (#52384) 2019-12-06 10:53:06 -08:00
package.json Remove rimraf (#48985) 2019-10-24 06:29:43 -07:00
README.md State containers (#52384) 2019-12-06 10:53:06 -08:00
tsconfig.json

@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

  • Ensure<T, X> — Makes sure T is of type X.
  • ObservableLike<T> — Minimal interface for an object resembling an Observable.
  • RecursiveReadonly<T> — Like Readonly<T>, but freezes object recursively.
  • ShallowPromise<T> — Same as Promise type, but it flat maps the wrapped type.
  • UnwrapObservable<T> — Returns wrapped type of an observable.
  • UnwrapPromise<T> — Returns wrapped type of a promise.