kibana/packages/kbn-utility-types
Tiago Costa c168791d24
[8.2] chore(NA): remove @kbn/utility-types/jest subpackage (#133448) (#133572)
* chore(NA): remove @kbn/utility-types/jest subpackage (#133448)

* chore(NA): remove @kbn/utility-types/jest subpackage

* chore(NA): include migration rule for import path

* chore(NA): remove double import

* chore(NA): creating a new package

* chore(NA): remove jest mentions from @kbn/utility-types

* docs(NA): complete new readme file

* [CI] Auto-commit changed files from 'node scripts/generate packages_build_manifest'

* chore(NA): remove expect error comment

* chore(NA): merge and solve problems with merge on latest upstream

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 3a6cc6e747)

# Conflicts:
#	src/core/public/chrome/chrome_service.mock.ts
#	src/core/server/core_context.mock.ts
#	src/core/server/mocks.ts
#	src/plugins/data/common/search/expressions/kibana_context.test.ts
#	src/plugins/data/common/search/search_source/mocks.ts
#	src/plugins/data/common/search/search_source/search_source.test.ts
#	src/plugins/data/public/search/collectors/create_usage_collector.test.ts
#	src/plugins/data/public/search/expressions/esaggs.test.ts
#	src/plugins/data/public/search/search_interceptor/search_interceptor.test.ts
#	src/plugins/data/public/search/search_service.test.ts
#	src/plugins/data/server/autocomplete/terms_agg.test.ts
#	src/plugins/data/server/search/expressions/esaggs.test.ts
#	src/plugins/data/server/search/search_service.test.ts
#	src/plugins/data/server/search/search_source/mocks.ts
#	src/plugins/data_view_management/server/routes/preview_scripted_field.test.ts
#	src/plugins/data_views/server/routes/has_data_views.test.ts
#	src/plugins/home/server/services/sample_data/sample_data_registry.test.ts
#	x-pack/plugins/cloud_security_posture/server/plugin.test.ts
#	x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts
#	x-pack/plugins/security/server/routes/api_keys/create.test.ts
#	x-pack/plugins/security/server/routes/api_keys/enabled.test.ts
#	x-pack/plugins/security/server/routes/authentication/common.test.ts
#	x-pack/plugins/security/server/routes/authentication/saml.test.ts
#	x-pack/plugins/security/server/routes/authorization/spaces/share_saved_object_permissions.test.ts
#	x-pack/plugins/security/server/routes/deprecations/kibana_user_role.test.ts
#	x-pack/plugins/security/server/routes/index.mock.ts
#	x-pack/plugins/security/server/routes/users/change_password.test.ts
#	x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-06-03 16:18:37 -07:00
..
src [8.2] chore(NA): remove @kbn/utility-types/jest subpackage (#133448) (#133572) 2022-06-03 16:18:37 -07:00
BUILD.bazel [8.2] chore(NA): remove @kbn/utility-types/jest subpackage (#133448) (#133572) 2022-06-03 16:18:37 -07:00
package.json chore(NA): splits types from code on @kbn/utility-types (#121923) 2021-12-23 02:55:13 +00:00
README.md use native Awaited instead of manually unwrapping types (#121781) 2021-12-23 14:55:39 +02:00
tsconfig.json [8.2] chore(NA): remove @kbn/utility-types/jest subpackage (#133448) (#133572) 2022-06-03 16:18:37 -07: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 { UnwrapObservable } from '@kbn/utility-types';

type A = Observable<string>;
type B = UnwrapObservable<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.
  • Values<T> — Returns object or array value types.