chore(NA): upgrade typescript into v4.9.5 (#175178)

This PR bumps the Typescript version used on Kibana into v4.9.5. The
full set of changes can be found
[here](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/).
So far, as long I can see, the performance is better than in the version
we're currently in.

I didn't want to make assumptions for such a diversity of type errors
across the codebase so instead I choose to mark the failures with
`@ts-expect-error` and let each team decide how to handle it.

There is a list below with the files (and teams those belong to) where
the annotations were added. If each team could provide help of fixing
the ones under their domain it would be fantastic. It can be done in
this PR or in subsequent ones.

Here it goes the list for follow up:

@elastic/kibana-core - tracking issue:
https://github.com/elastic/kibana/issues/176153
- [ ]
[packages/analytics/client/src/analytics_client/analytics_client.ts](https://github.com/elastic/kibana/pull/175178/files#diff-57477fa4b8c2fcd5a3159e8a6a9a1db80199dbe94b2917a520d4dcee4f65599b)
- [ ]
[packages/analytics/client/src/analytics_client/context_service.ts](https://github.com/elastic/kibana/pull/175178/files#diff-b7802a3b9a46305607ff678abde499d9c9e1dd8b1f3f6a76add1a8c3a0b94e43)
- [ ]
[packages/analytics/client/src/analytics_client/types.ts](https://github.com/elastic/kibana/pull/175178/files#diff-6584fc2ecf29864805de0f0f82dcff81a850b53aeff25932a598c9157c991d43)
- [ ]
[packages/core/http/core-http-router-server-internal/src/validator.ts](https://github.com/elastic/kibana/pull/175178/files#diff-5a4d386d142b33439aa7c638b7ddc2300da40155c636b4cf3119929b8bb57b72)
- [ ]
[packages/core/http/core-http-server-internal/src/cookie_session_storage.ts](https://github.com/elastic/kibana/pull/175178/files#diff-9efcaa58a5bdbfcac57c68b9c2e108b921c9c5ea88abf90920191b150d56a03a)
- [ ]
[packages/core/plugins/core-plugins-server-internal/src/create_browser_config.ts](https://github.com/elastic/kibana/pull/175178/files#diff-b49a02fac82b32dd34c271d0ed71f7f79f173591e6810b32093975bd50fe11b1)
- [ ]
[packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/bulk_update.ts](https://github.com/elastic/kibana/pull/175178/files#diff-9a151f7dc25effb6f2bb084075b7d1d8e8ee049dcd91e92a0d27e014d3bc82b8)
- [ ]
[packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/update.ts](https://github.com/elastic/kibana/pull/175178/files#diff-d5a4ebda74b0c2e2ca625fe395a185e3ff0076bc44614cf640cf33cbc5cba2bd)
- [ ]
[packages/kbn-es-types/src/search.ts](https://github.com/elastic/kibana/pull/175178/files#diff-49222c37a13c4c85c287947aaa8293029513f4a34933fcac6116ad3059ee8fcf)
- [ ]
[packages/kbn-utility-types/src/dot.ts](https://github.com/elastic/kibana/pull/175178/files#diff-f14998302c20ca97ac7f3faa7b542f22670708eac134e6af96c354489a641689)
- [ ]
[src/core/server/mocks.ts](https://github.com/elastic/kibana/pull/175178/files#diff-a3e30603bf537517842354df3548e88a25f4d9e2a6be08f95b88fb8db48e4228)
- [ ]
[test/plugin_functional/test_suites/core_plugins/rendering.ts](https://github.com/elastic/kibana/pull/175178/files#diff-eb6bd8a02c024aa1ab5c3debbeda149e8d2fb2614bca80d09c3f9aa21100ed7d)

@elastic/kibana-presentation 
- [ ]
[packages/content-management/content_editor/src/__jest__/tests.helpers.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-6e56e39c2e9accef38070408bb589fb4cc973e4353098574be142aa8e3da399e)
- [ ]
[src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts](https://github.com/elastic/kibana/pull/175178/files#diff-1aa4b1f585b7a75d996ad7620d8cfef03584e41f77d529172acc5250f5de092f)
- [ ]
[src/plugins/presentation_util/public/services/create/provider.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-baa5fb3d72bf64b6c269155b736f6af387688b0f2f77d804f5fd5ced69d3e2c9)
- [ ]
[x-pack/plugins/canvas/canvas_plugin_src/functions/server/pointseries/index.ts](https://github.com/elastic/kibana/pull/175178/files#diff-da216f23664ac188404e9a48cdf33b05ad121512d988da5cd88a72724d5bfff9)
- [ ]
[x-pack/plugins/canvas/server/templates/status_report.ts](https://github.com/elastic/kibana/pull/175178/files#diff-45598e8b99710f8fd7a0a00eb7b0810cb24bf529b7fefb52dfd5f05b82a23578)
- [ ]
[x-pack/plugins/canvas/server/templates/summary_report.ts](https://github.com/elastic/kibana/pull/175178/files#diff-b1eb9cec629f0adcae86dede388d6b343b785970a458fbf57c96dbd32b3fc8b5)
- [ ]
[x-pack/plugins/canvas/types/arguments.ts](https://github.com/elastic/kibana/pull/175178/files#diff-c7d1e4fa5026000bb99d03e5dace364226857c8e1e928a182c14c3f33f0006d9)
- [ ]
[x-pack/plugins/canvas/types/functions.ts](https://github.com/elastic/kibana/pull/175178/files#diff-00548b1936e05f24bc8dcbf453bf5a49f0f129989bab422926d3f4b56e35abae)

@elastic/apm 
- [ ]
[packages/kbn-apm-synthtrace-client/src/lib/interval.ts](https://github.com/elastic/kibana/pull/175178/files#diff-ec08c88331cc24811a3e24cec3aa99d02a707fb1a5848e1fb3a7c3172f99f1e7)
- [ ]
[packages/kbn-apm-synthtrace/src/lib/shared/get_serialize_transform.ts](https://github.com/elastic/kibana/pull/175178/files#diff-98d45df58fce30ac60a87c3a88aa7368ecf16f5b79b68a67419d8546974e42db)
- [ ]
[packages/kbn-apm-synthtrace/src/lib/utils/with_client.ts](https://github.com/elastic/kibana/pull/175178/files#diff-612d609963c9fe7830bc4e522bd3bb614369772906708b163e9854ec85cf879c)
- [ ]
[x-pack/plugins/apm/server/lib/helpers/transactions/get_is_using_transaction_events.test.ts](https://github.com/elastic/kibana/pull/175178/files#diff-69ee25aee396b7ccb9cc749b4f9cfad19a380bf3c4eb1f2d1848390b75477732)

@elastic/obs-knowledge-team  
- [ ]
[packages/kbn-io-ts-utils/src/to_json_schema/index.ts](https://github.com/elastic/kibana/pull/175178/files#diff-012b20f075e09f40a1839b759082ffea0122aeb79d6b5fd5e642f9abee2435e2)
- [ ]
[packages/kbn-server-route-repository/src/test_types.ts](https://github.com/elastic/kibana/pull/175178/files#diff-a4e28211d0c856831b71488f849f1c9e542373d4a287baa3cbfa032278cc8dc0)

@elastic/security-detection-engine   
- [ ]
[packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.test.ts](https://github.com/elastic/kibana/pull/175178/files#diff-594114826caa3dee11e8dda5d6a67d4ce852b02f5d4df9721925c19d9c5d97af)
- [ ]
[packages/kbn-securitysolution-utils/src/add_remove_id_to_item/index.ts](https://github.com/elastic/kibana/pull/175178/files#diff-8a1645d3d66eedeb05f8d954a3855523f8403b7a9c59200ad8184af96bb28cfb)
- [ ]
[x-pack/plugins/lists/server/routes/utils/build_siem_response.ts](https://github.com/elastic/kibana/pull/175178/files#diff-170882f010e12304aec81e167487cfc086c2d6a1d7dbbb36d1db2215d072577e)

@elastic/appex-sharedux 
- [ ]
[packages/shared-ux/router/impl/routes.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-43ba27115faf87c05460364c3b30b32f2794451404c82470653ccd9258e944b8)
- [ ]
[src/plugins/files/server/routes/file_kind/enhance_router.ts](https://github.com/elastic/kibana/pull/175178/files#diff-33258e2bd2f400b53a1366511ec3ef1c83b8f0aee762c1bd83abdea3ff153c2a)
- [ ]
[src/plugins/files/server/routes/types.ts](https://github.com/elastic/kibana/pull/175178/files#diff-bad66d1fdd59cf33bfa9a20aa96dde580fab1b7da8252723ee08c4e99203074f)

@elastic/kibana-visualizations 
- [x]
[src/plugins/chart_expressions/expression_legacy_metric/public/__stories__/metric_renderer.stories.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-e66ed20c106e40aee23cbca1980280ef6600797f5d2210486be007d7fe5d72ca)
- [x]
[src/plugins/chart_expressions/expression_legacy_metric/public/components/with_auto_scale.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-d45fb549abb422cdd706da86c52a3d9dc3b0517f028b966b20cf2679aabcd24f)
- [x]
[src/plugins/expressions/common/execution/execution_contract.ts](https://github.com/elastic/kibana/pull/175178/files#diff-8817ec58899f80b4bfd6144dc59c3e6dc9a508e31264cd2bdf155a0b1746d9f9)
- [x]
[src/plugins/vis_types/table/public/components/table_vis_basic.test.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-4de9a68e38b105b862755f59d2d05722bfba6ffc85dcb0b2cf5eaf754a6afb50)
- [x]
[src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/percentile.ts](https://github.com/elastic/kibana/pull/175178/files#diff-c5fef6976b67ee678ec2dda15e0bd3ca56bef8404565499b915783a40c3c908d)
- [x]
[src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/percentile_rank.ts](https://github.com/elastic/kibana/pull/175178/files#diff-8ad6988492e0ada34f9899f56f40533e41e537d6d79af1cc3794fdb68fbff358)
- [x]
[src/plugins/visualizations/public/vis.ts](https://github.com/elastic/kibana/pull/175178/files#diff-15c314cac8f334b9e9feb83d9f23c0c9e94f4c85405cfa4b4e3b3b445bd6763e)
- [x]
[src/plugins/visualizations/public/vis_async.ts](https://github.com/elastic/kibana/pull/175178/files#diff-d5e129fbb0217fe4da38f828794cd141bc6a4d32d87847713920312a5d27f150)
- [ ]
[x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.test.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-5624778a752c98be20953fd297e58165dab354ddab95bcf0c6b2a91d854a9c71)
- [x]
[x-pack/plugins/lens/public/debounced_component/debounced_component.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-9c14c9f29c5b351993b25d462b1d988e354068a1db9a8651515c3ee85fbd6ce9)
- [ ]
[x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-8ca1f3be4f6696d9c05773cfaa23d7489a1c460fffdf39c8ad2ba8aa09f6c194)
- [ ]
[x-pack/plugins/lens/public/embeddable/expression_wrapper.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-d3a5ba0620f3712afd6af94b1f4ceea107d356c6812ae245d1b496caf86c54a7)
- [x]
[x-pack/plugins/lens/public/state_management/lens_slice.ts](https://github.com/elastic/kibana/pull/175178/files#diff-8b56f34b3034981765e12503ccd32ca15b2d889ab6acd594737ae5313a5e2312)
- [x]
[x-pack/plugins/lens/server/migrations/common_migrations.ts](https://github.com/elastic/kibana/pull/175178/files#diff-7609127370894696659846e16e36353fda9cc11150c663334236caf597854b24)
- [ ]
[src/plugins/embeddable/public/registry/saved_object_to_panel_methods.ts](bcd925ecb6 (diff-1401b355377c76ab6458756aa0e3177beef5ec56796c58b7a52b5e003f85b5cf))

@elastic/kibana-data-discovery 
- [ ]
[src/plugins/data_view_management/public/components/test_utils.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-60386b173801a1e7fa97b99de49501c4fe7053c099ee06107292461acc7d26a8)
- [ ]
[src/plugins/unified_histogram/public/layout/layout.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-03181d67508c4c66d682a019b9b1e9235ca8a6dc656450e563422c9720bfa24f)

@elastic/platform-deployment-management 
- [ ]
[src/plugins/es_ui_shared/static/forms/hook_form_lib/components/use_field.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-ef2d4424a31a8d8def4c1c2d9d756cfef9cc58b30837c1b6639e3419e572cdd9)
- [ ]
[src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts](https://github.com/elastic/kibana/pull/175178/files#diff-b80eb528652fd57fe88cae03deed4737cba5992b3a9ddf62259e4aa892b2ec68)
- [ ]
[src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field_from_props.ts](https://github.com/elastic/kibana/pull/175178/files#diff-ac8d10db6808671a05edbe0e9f4cecf330377cf85aaef8d96019e8e1dc7987ef)
- [ ]
[src/plugins/es_ui_shared/static/forms/hook_form_lib/types.ts](https://github.com/elastic/kibana/pull/175178/files#diff-3e75c35c5d016b55290a30604c278eaf90bbd5a78a26613dbed19f0abd59212f)

@elastic/kibana-security 
- [x]
[src/plugins/interactive_setup/public/use_form.ts](https://github.com/elastic/kibana/pull/175178/files#diff-afe9ad58c9ccaf628d72ed916620587703bd960ba313e3199fbef4c98ad30841)

@elastic/ml-ui 
- [ ]
[x-pack/packages/ml/cancellable_search/src/use_cancellable_search.ts](https://github.com/elastic/kibana/pull/175178/files#diff-4a366c647aadac020022b1186fa424fa6475b2ba907d9391cfff5e77863dec48)
- [ ]
[x-pack/packages/ml/date_picker/src/components/full_time_range_selector.test.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-b5dd4c2d53eedbc4d749261001ab2f735f798ec6cbf249c900db517294a4ec59)
- [ ]
[x-pack/plugins/aiops/public/hooks/use_cancellable_search.ts](https://github.com/elastic/kibana/pull/175178/files#diff-361b7df5c49f9b67a897baab531df2456ceba3b57eaee9b2bb193b4d70aed052)
- [ ]
[x-pack/plugins/data_visualizer/public/application/data_drift/use_data_drift_result.ts](https://github.com/elastic/kibana/pull/175178/files#diff-0c1ebe9287033ed3afdbe615c8e95f6091285de5df1455134d9f6d14d3e9b970)

@elastic/response-ops 
- [ ]
[x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.ts](https://github.com/elastic/kibana/pull/175178/files#diff-a4ecdf971673064aa6dc4ab5620e7b128efcc27b3e77804a3753d2839eaa7ba2)
- [ ]
[x-pack/plugins/alerting/server/application/rule/methods/resolve/types/resolved_rule.ts](https://github.com/elastic/kibana/pull/175178/files#diff-fd0549bd17f14e41a3c47a0dfe01a3cbd76f141983aa076ce30537db4edb0f0c)
- [ ]
[x-pack/plugins/alerting/server/routes/get_rule.test.ts](https://github.com/elastic/kibana/pull/175178/files#diff-5c8d8530f6a5ebb71ff59f03cb212af6ca2cffe015ee061cd998d11b63f5fd2d)
- [ ]
[x-pack/plugins/alerting/server/routes/lib/rewrite_rule.test.ts](https://github.com/elastic/kibana/pull/175178/files#diff-032345b22421e404941669203a41b51b23a5223a555ef286ab29ff1ea199a287)
- [ ]
[x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.test.ts](https://github.com/elastic/kibana/pull/175178/files#diff-425f9213402823ce800f9f4400ccce476c1b15d82302f238b3e07312bcacf1fe)
- [ ]
[x-pack/plugins/cases/public/api/utils.ts](https://github.com/elastic/kibana/pull/175178/files#diff-3b36a4b3a6bcd19c1ee4aa7f83fb50e08ae3715c936c26ca911df9e8da319d63)
- [ ]
[x-pack/plugins/cases/public/components/case_view/components/user_list.test.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-1ce6d0fd74881ed9a9dd9bbe7ec597083382aee3395fb032c46ec7acd8a201f5)
- [ ]
[x-pack/plugins/stack_connectors/public/connector_types/opsgenie/params.test.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-e08360892ade8eba65f8e6097525cb749918b8beb9d949d3f9e3a79dfcb9df97)
- [ ]
[x-pack/plugins/triggers_actions_ui/public/application/lib/suspended_component_with_props.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-2f91d7445dd017643fe50c068a42d4c143ca0208aac42ad35d10401aaf6480c6)
- [ ]
[x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_alerts_filter_timeframe.test.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-37c30c5d49eaaaeef4e05d01d4e6e73584684ab9707d731c7945aca56cde6091)
- [ ]
[x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_conditions.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-51a33d1d3b082b2615edd649b7ebc3bdb00e9c107cee754e468fa9512d064835)
- [ ]
[x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_conditions_group.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-24314823291cc4b2970c60f3c66c9e1c2d49aa88b668a063dd1d44724cde7080)

@elastic/security-threat-hunting-investigations
- [ ]
[x-pack/plugins/ecs_data_quality_dashboard/server/lib/build_response/index.ts](https://github.com/elastic/kibana/pull/175178/files#diff-8aefd6c90e985c7a1c8715b4c894be71e3d8abcb58fad0c513b4ab37e23cffbb)

@elastic/security-generative-ai
- [ ]
[x-pack/plugins/elastic_assistant/server/lib/build_response/index.ts](https://github.com/elastic/kibana/pull/175178/files#diff-0e0fa80b96f36b0daa287213f9f35da73adfd869d33b16a4f44ab1a336f66925)

@elastic/enterprise-search-frontend
- [ ]
[x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector_total_stats.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-61c41618bb97778cb1fd7d0645ddc07e779f1b1c63a0e7684b0a6df664de0c91)
- [ ]
[x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler_total_stats.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-d8651696438142564028406ccab850b316a3fb3b6d5f38ca7e4e6804f6491d1b)
- [ ]
[x-pack/plugins/enterprise_search/public/applications/search_index/pipelines/pipelines_json_configurations_logic.ts](https://github.com/elastic/kibana/pull/175178/files#diff-d77f51637904e4d4672b6b2d7f7ced6df73af142e8ba3fb5a074c700b5cf0fd0)
- [ ]
[x-pack/plugins/enterprise_search/public/applications/shared/accordion_list/accordion_list.test.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-f19e11825ff7d643f74a9f95cda32843685c28f0a7e7fc8b6d9f05dc659e0ee7)

@elastic/fleet 
- [ ]
[x-pack/plugins/fleet/.storybook/context/fixtures/integration.nginx.ts](https://github.com/elastic/kibana/pull/175178/files#diff-0d84f41c1e7da6af3d1dc869fa722c384247beddf2a58de6c00bdedd3a835ed1)
- [ ]
[x-pack/plugins/fleet/common/authz.test.ts](https://github.com/elastic/kibana/pull/175178/files#diff-25b3fe4e87a154100ec03010e9c5f08a00790104352757922f03caf2c24536f8)
- [ ]
[x-pack/plugins/fleet/public/applications/fleet/sections/settings/hooks/use_confirm_modal.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-ea640c827015978c83ae51a221392f57124a6fccb90c977991133baa020f6487)
- [ ]
[x-pack/plugins/fleet/server/services/preconfiguration.ts](https://github.com/elastic/kibana/pull/175178/files#diff-82d451a43233c196f1c527436ec5b4afe16c669d25f912086ef83939fe04fbda)

@elastic/platform-deployment-management
- [ ]
[x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/form_errors_context.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-6fdd461892c891ebad0ba30154ecf28479dd10c63b756eb57e658a02cb62ae63)

@elastic/obs-ux-logs-team / @elastic/obs-ux-infra_services-team

- [ ]
[x-pack/plugins/infra/public/containers/metrics_source/source.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-f27b71c245d27489c408611dfd2d2c020e4e881b6db7dcaf0b2f0cf8401ce5a1)
- [ ]
[x-pack/plugins/infra/public/pages/metrics/metric_detail/components/section.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-d782e8608b4b6ec1e5de15432ee899be94dfbdbedddc8d94b09c3399e2754294)
- [ ]
[x-pack/plugins/infra/public/pages/metrics/metric_detail/components/sub_section.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-eb598de689a9aa6536795e7f63a7c59a771c2c4e0a0bb81ee0102c8ce864620d)
- [ ]
[x-pack/plugins/logs_shared/public/components/logging/log_text_stream/vertical_scroll_panel.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-68bd0b43320ea3e59359e977d70f1c2e33518c1de5d97f39df17cb0a6a71cb99)
- [x]
[x-pack/plugins/observability_solution/logs_explorer/public/utils/proxies.ts](https://github.com/elastic/kibana/pull/175178/files#diff-134c464cedf12a2a2e1bceb1014d63e9ac7df4fd263ee5fe4ddd13fe3af7382d)
- [x]
[x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_add_edit/form/validation.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-cf41bdb5d7247755b3b5dff0f428d847c9aa2f1ecff14c4e8fbfec5048e3ff91)
- [x]
[x-pack/plugins/synthetics/public/apps/synthetics/state/service_locations/api.ts](https://github.com/elastic/kibana/pull/175178/files#diff-571225171a2250a7b66cdc308eea2308cccdfc5ddf69c454dffd59d890947fe3)
- [x]
[x-pack/plugins/synthetics/public/utils/api_service/api_service.ts](https://github.com/elastic/kibana/pull/175178/files#diff-04d770eab9404afbf543d52e1ca2e869e0248f86ca2943d8811ca95a6a37f331)
- [x]
[x-pack/plugins/synthetics/server/routes/types.ts](https://github.com/elastic/kibana/pull/175178/files#diff-ddd7e79b79cf790fbd1798174b6f6a25cd869d1afd4ecf53f1a3febaa980f618)
- [x]
[x-pack/plugins/synthetics/server/synthetics_service/service_api_client.ts](https://github.com/elastic/kibana/pull/175178/files#diff-b22608feca8f7a00a94d538f7a51c1be3bbd355d9966e5a1e4b4b2e84c663342)
- [x]
[x-pack/plugins/uptime/public/legacy_uptime/components/common/monitor_tags.test.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-840db8c32fd91ca5075b60203426a93bff6a3e522f7d65f0a9c5b02733071cf4)
- [x]
[x-pack/plugins/uptime/public/legacy_uptime/state/api/utils.ts](https://github.com/elastic/kibana/pull/175178/files#diff-576a5e3c17bfaeaaf8f1c3df1cfc7f84021bf7ee234e7df77c38cd0afd90d573)
- [x]
[x-pack/plugins/uptime/public/utils/api_service/api_service.ts](https://github.com/elastic/kibana/pull/175178/files#diff-85df170f1ea77dc9faa8aaec88929babd7bd24ee78845ea5bb8e9ed43c19e051)
- [x]
[x-pack/plugins/uptime/server/legacy_uptime/lib/requests/get_snapshot_counts.ts](https://github.com/elastic/kibana/pull/175178/files#diff-f80f1cca2be5a43785f840c2705b59732e4eb8b57f8879806600b3220e9bb234)
- [x]
[x-pack/plugins/uptime/server/legacy_uptime/lib/requests/search/find_potential_matches.ts](https://github.com/elastic/kibana/pull/175178/files#diff-80c8152e4da9f7d2fa42cd5dcf35a34c70cd86b32da08d0710620272ac4e9f62)
- [x]
[x-pack/plugins/uptime/server/legacy_uptime/lib/requests/search/query_context.ts](https://github.com/elastic/kibana/pull/175178/files#diff-8692f1eec652074b463e4b8478116ba796ce5cd0bcc818755300b36e80baeb95)
- [x]
[x-pack/plugins/uptime/server/legacy_uptime/lib/requests/search/refine_potential_matches.ts](https://github.com/elastic/kibana/pull/175178/files#diff-7b93319a7e63eb6e09cbb3147b49f40ef794f684be024d62f094c72cfdb2693c)
- [x]
[x-pack/plugins/uptime/server/legacy_uptime/routes/types.ts](https://github.com/elastic/kibana/pull/175178/files#diff-5618c2b61f704802d87c620000f5500f2340605fbe8abe5a261864e83ed9eded)
- [x]
[x-pack/plugins/ux/public/application/ux_app.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-0bd45972562be4fcdad56b6fe2c2c9800775689067b0c2a956733e5c334b43c9)
- [x]
[x-pack/plugins/ux/public/components/app/rum_dashboard/ux_overview_fetchers.ts](https://github.com/elastic/kibana/pull/175178/files#diff-8bfd9c637261e22d413a95546cb9dd54efcd41930646fbdf8081965f81b4dcf3)

@elastic/kibana-gis 
- [ ]
[x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts](https://github.com/elastic/kibana/pull/175178/files#diff-23b9c9add47e2d51d022faf8e8527b46febf5d265fdddfb383bbc86b58257691)
- [ ]
[x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_style_property.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-b981aee9ac5aa5b1eb7f811eae5a461f15835f2d81d693b40a402fd55a8b9f59)
- [ ]
[x-pack/plugins/maps/public/classes/styles/vector/symbol_utils.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-94970fa194c5e647c78a36fe6c8894365780f320f77db6065572bec88ac5586b)
- [ ]
[x-pack/plugins/maps/public/lazy_wrapper.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-27e988b8e71057b5c527ff008ca6c92a545bbe29ddeb9ea2a461aeb5bdb498ae)

@elastic/observability-ui 
- [ ]
[x-pack/plugins/observability_shared/public/contexts/inspector/inspector_context.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-cd6617fddf50f9a5e29d8674a54dbd8d65e298f31fec6c2a9635bd39681b6910)

@elastic/security-defend-workflows
- [ ]
[x-pack/plugins/osquery/common/utility_types.ts](https://github.com/elastic/kibana/pull/175178/files#diff-e1aaf9c0e4f18af25b940e2b0aa55fb274022fa5fd2e378276c88da6b0e7c392)

@elastic/security-solution
- [ ]
[x-pack/plugins/security_solution/common/endpoint/generate_data.ts](https://github.com/elastic/kibana/pull/175178/files#diff-12dc63d6524a714b19d487bcf75486270eea7d5d52e6d1ecdeaa935545f33ac0)
- [x]
[x-pack/plugins/security_solution/common/utility_types.ts](https://github.com/elastic/kibana/pull/175178/files#diff-8d3ac0c16b9803465d90e48032b32738dfe8ff891b152677542607db57cb684b)
- [ ]
[x-pack/plugins/security_solution/public/common/components/page/manage_query.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-43f472ce0931147aadfa34f11cbb0804c1ef968a999528f3ac70ac39977dde21)
- [ ]
[x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts](https://github.com/elastic/kibana/pull/175178/files#diff-f8273324b45291f2561273d33a0080807a82fb7deb08124d06418f2882360d5b)
- [ ]
[x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts](https://github.com/elastic/kibana/pull/175178/files#diff-4653e6776fc5d5ab3dba81b9d1df1b23d936975d5770c6456eb6ecda99951b8b)
- [ ]
[x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts](https://github.com/elastic/kibana/pull/175178/files#diff-c69f65409bc0c3c1d986616357292a9506e02d5510f418e3969add19ed5c9073)
- [ ]
[x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.ts](https://github.com/elastic/kibana/pull/175178/files#diff-0b2b3087618234227771b2c2c7b905c727225a158f21cdc7f70148ec22938ad8)
- [ ]
[x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts](https://github.com/elastic/kibana/pull/175178/files#diff-c4ccd8146a7b8614dd2b431e552f0a9cdd2fa759e852f16898b1e4ca5ae31520)
- [ ]
[x-pack/plugins/security_solution/public/common/lib/kibana/hooks.ts](https://github.com/elastic/kibana/pull/175178/files#diff-8aba26a2e24f78b4272485f28691a6315422c65537c9ae54ff5754b0bd75bc5d)
- [ ]
[x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/description_step/index.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-cfed12b5fe28617d39f22c2f5e5573e1f7c5bab15bc274245b71fefb0b67540f)
- [ ]
[x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_table.tsx](https://github.com/elastic/kibana/pull/175178/files#diff-e15c09422e069163df1b0e68c612fe7000aa83c817bbca386f5a59a6251ccfab)
- [ ]
[x-pack/plugins/security_solution/scripts/endpoint/common/agent_downloads_service.ts](https://github.com/elastic/kibana/pull/175178/files#diff-74090a1d7f0d5bcef92cf0f90c279334c8742fc45dad51dcc733113124689847)
- [ ]
[x-pack/plugins/security_solution/server/endpoint/services/actions/clients/mocks.ts](https://github.com/elastic/kibana/pull/175178/files#diff-cd5726e4db2d4f93c2fa913032e9803facf1ed926ce0ba38864c0342d9ff968e)
- [ ]
[x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.ts](https://github.com/elastic/kibana/pull/175178/files#diff-637b99199ff7a5c6e2cc30bf4a460118fc7357afe5f60bdfeb0cb724701fc405)
- [ ]
[x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/bulk_actions/utils.ts](https://github.com/elastic/kibana/pull/175178/files#diff-288cb69918810a15b715a67fd6d978dfc6aaa64630b3f06ff5c9bf7485cb8cc7)
- [ ]
[x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/bulk_actions/validations.ts](https://github.com/elastic/kibana/pull/175178/files#diff-b6c6d3cff1c78443a0b5d34b6ec820ce9fa8584b1a88c82b7fde100788655381)
- [ ]
[x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_dev_tool_content/routes/read_prebuilt_dev_tool_content_route.ts](https://github.com/elastic/kibana/pull/175178/files#diff-f2f612dd995d2c059b2e28dde1009b16c361ce9e1ae4600343c47d3beacfb0a3)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@elastic.co>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Co-authored-by: achyutjhunjhunwala <achyut.jhunjhunwala@elastic.co>
Co-authored-by: Justin Kambic <jk@elastic.co>
Co-authored-by: Jan Monschke <jan.monschke@elastic.co>
This commit is contained in:
Tiago Costa 2024-02-25 01:23:57 +00:00 committed by GitHub
parent dd06748484
commit 250790e0f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
145 changed files with 338 additions and 179 deletions

View file

@ -89,7 +89,7 @@
"**/isomorphic-fetch/node-fetch": "^2.6.7",
"**/remark-parse/trim": "1.0.1",
"**/sharp": "0.32.6",
"**/typescript": "4.7.4",
"**/typescript": "4.9.5",
"globby/fast-glob": "^3.2.11"
},
"dependencies": {
@ -1677,7 +1677,7 @@
"tree-kill": "^1.2.2",
"ts-morph": "^15.1.0",
"tsd": "^0.20.0",
"typescript": "4.7.4",
"typescript": "4.9.5",
"url-loader": "^2.2.0",
"val-loader": "^1.1.1",
"vinyl-fs": "^4.0.0",

View file

@ -168,6 +168,7 @@ export class AnalyticsClient implements IAnalyticsClient {
this.optInConfig$.next(optInConfigInstance);
};
// @ts-expect-error upgrade typescript v4.9.5
public registerContextProvider = <Context>(contextProviderOpts: ContextProviderOpts<Context>) => {
this.contextService.registerContextProvider(contextProviderOpts);
};

View file

@ -30,7 +30,7 @@ export class ContextService {
public registerContextProvider<Context>({
name,
context$,
schema,
schema, // @ts-expect-error upgrade typescript v4.9.5
}: ContextProviderOpts<Context>) {
if (this.contextProvidersSubscriptions.has(name)) {
throw new Error(`Context provider with name '${name}' already registered`);
@ -60,6 +60,7 @@ export class ContextService {
.subscribe((context) => {
// We store each context linked to the context provider so they can increase and reduce
// the number of fields they report without having left-overs in the global context.
// @ts-expect-error upgrade typescript v4.9.5
this.contextProvidersRegistry.set(name, context);
// For every context change, we rebuild the global context.

View file

@ -205,6 +205,7 @@ export interface IAnalyticsClient {
*
* @track-adoption
*/
// @ts-expect-error upgrade typescript v4.9.5
registerContextProvider: <Context>(contextProviderOpts: ContextProviderOpts<Context>) => void;
/**
* Removes the context provider and stop enriching the events from its context.

View file

@ -32,6 +32,7 @@ export function WithServices<P>(Comp: ComponentType<P>, overrides: Partial<Servi
const services = getMockServices(overrides);
return (
<ContentEditorProvider {...services}>
{/* @ts-expect-error upgrade typescript v4.9.5*/}
<Comp {...props} />
</ContentEditorProvider>
);

View file

@ -127,8 +127,10 @@ export class RouteValidator<P = {}, Q = {}, B = {}> {
namespace?: string
): RouteValidationResultType<typeof validationRule> {
if (isConfigSchema(validationRule)) {
// @ts-expect-error upgrade typescript v4.9.5
return validationRule.validate(data, {}, namespace);
} else if (typeof validationRule === 'function') {
// @ts-expect-error upgrade typescript v4.9.5
return this.validateFunction(validationRule, data, namespace);
} else {
throw new ValidationError(

View file

@ -113,6 +113,7 @@ export async function createCookieSessionStorageFactory<T>(
return {
asScoped(request: KibanaRequest) {
// @ts-expect-error upgrade typescript v4.9.5
return new ScopedCookieSessionStorage<T>(log, server, ensureRawRequest(request));
},
};

View file

@ -61,7 +61,6 @@ function checkIsPathExposed<T = unknown>(
// Traverse the path to see if it is exposed or not
const exposedConfig = descriptor[key as keyof ExposedToBrowserDescriptor<T>];
if (exposedConfig && typeof exposedConfig === 'object') {
// @ts-expect-error Type 'undefined' is not assignable to type 'ExposedToBrowserDescriptor<T>'
descriptor = exposedConfig;
continue;
}

View file

@ -262,6 +262,7 @@ export const performBulkUpdate = async <T>(
const typeDefinition = registry.getType(type)!;
const updatedAttributes = mergeForUpdate({
// @ts-expect-error upgrade typescript v4.9.5
targetAttributes: {
...migrated!.attributes,
},

View file

@ -247,6 +247,7 @@ export const executeUpdate = async <T>(
// therefor we can safely process with the "standard" update sequence.
const updatedAttributes = mergeForUpdate({
// @ts-expect-error upgrade typescript v4.9.5
targetAttributes: {
...migrated!.attributes,
},

View file

@ -32,7 +32,7 @@ interface IntervalOptions {
rate?: number;
}
export class Interval<TFields = Fields> {
export class Interval<TFields extends Fields = Fields> {
private readonly intervalAmount: number;
private readonly intervalUnit: unitOfTime.DurationConstructor;
@ -63,7 +63,7 @@ export class Interval<TFields = Fields> {
return timestamps;
}
*generator<TGeneratedFields = TFields>(
*generator<TGeneratedFields extends Fields = TFields>(
map: (
timestamp: number,
index: number

View file

@ -37,6 +37,7 @@ export function getSerializeTransform<TFields = ApmFields>() {
push(this, nextEvents, nextCallback);
}
},
// @ts-expect-error upgrade typescript v4.9.5
write(chunk: Serializable<TFields>, encoding, callback) {
push(this, chunk.serialize(), callback);
},

View file

@ -12,7 +12,9 @@ import { ApmSynthtraceEsClient, LogsSynthtraceEsClient } from '../../..';
export type SynthtraceEsClient = ApmSynthtraceEsClient | LogsSynthtraceEsClient;
export type SynthGenerator<TFields> =
// @ts-expect-error upgrade typescript v4.9.5
| SynthtraceGenerator<TFields>
// @ts-expect-error upgrade typescript v4.9.5
| Array<SynthtraceGenerator<TFields>>
| Readable;

View file

@ -593,7 +593,8 @@ export type AggregateOf<
export type AggregateOfMap<TAggregationMap extends AggregationMap | undefined, TDocument> = {
[TAggregationName in keyof TAggregationMap]: Required<TAggregationMap>[TAggregationName] extends AggregationsAggregationContainer
? AggregateOf<TAggregationMap[TAggregationName], TDocument>
? // @ts-expect-error not sure how to fix this, anything I've tried causes errors upstream - Dario
AggregateOf<TAggregationMap[TAggregationName], TDocument>
: never; // using never means we effectively ignore optional keys, using {} creates a union type of { ... } | {}
};

View file

@ -7,7 +7,7 @@
*/
import * as t from 'io-ts';
import { mapValues } from 'lodash';
import { isParsableType } from '../parseable_types';
import { isParsableType, ParseableType } from '../parseable_types';
interface JSONSchemaObject {
type: 'object';
@ -45,7 +45,7 @@ type JSONSchema =
| JSONSchemaAllOf
| JSONSchemaAnyOf;
export const toJsonSchema = (type: t.Mixed): JSONSchema => {
export const toJsonSchema = (type: t.Type<any> | ParseableType): JSONSchema => {
if (isParsableType(type)) {
switch (type._tag) {
case 'ArrayType':

View file

@ -8,7 +8,7 @@
export function omit<T, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {
const result: any = {};
for (const [key, value] of Object.entries(obj) as any) {
for (const [key, value] of Object.entries(obj as any) as any) {
if (!keys.includes(key)) {
result[key] = value;
}

View file

@ -42,6 +42,7 @@ describe('threat_mapping', () => {
field: 'field.one',
type: 'mapping',
value: 'field.one',
// @ts-expect-error upgrade typescript v4.9.5
extra: 'blah',
},
];
@ -120,6 +121,7 @@ describe('threat_mapping', () => {
value: 'field.one',
},
],
// @ts-expect-error upgrade typescript v4.9.5
extra: 'invalid',
},
];
@ -140,6 +142,7 @@ describe('threat_mapping', () => {
field: 'field.one',
type: 'mapping',
value: 'field.one',
// @ts-expect-error upgrade typescript v4.9.5
extra: 'blah',
},
],

View file

@ -19,6 +19,7 @@ import { v4 as uuidv4 } from 'uuid';
*/
type NotArray<T> = T extends unknown[] ? never : T;
export const addIdToItem = <T>(item: NotArray<T>): T => {
// @ts-expect-error upgrade typescript v4.9.5
const maybeId: typeof item & { id?: string } = item;
if (maybeId.id != null) {
return item;
@ -41,6 +42,7 @@ export const removeIdFromItem = <T>(
},
Exclude<keyof T, 'id'>
> => {
// @ts-expect-error upgrade typescript v4.9.5
const maybeId: typeof item & { id?: string } = item;
if (maybeId.id != null) {
const { id, ...noId } = maybeId;

View file

@ -69,11 +69,10 @@ createServerRouteFactory<{}, { options: { tags: string[] } }>()({
});
// Public APIs should be versioned
// @ts-expect-error
createServerRouteFactory<{}, { options: { tags: string[] } }>()({
// @ts-expect-error
endpoint: 'GET /api/endpoint_with_params',
options: {
// @ts-expect-error
tags: [],
},
// @ts-expect-error

View file

@ -21,7 +21,7 @@ describe('createKibanaProgram', () => {
"fetch": Object {
"typeDescriptor": Object {
"locale": Object {
"kind": 150,
"kind": 152,
"type": "StringKeyword",
},
},

View file

@ -41,7 +41,9 @@ type DotKey<
TKey extends keyof TObject & string,
TPrefix extends string
> = TObject[TKey] extends Array<infer TValueType>
? ToArray<DotObject<TValueType, `${TPrefix}${TKey}.`>>
? TValueType extends Record<string, any>
? ToArray<DotObject<TValueType, `${TPrefix}${TKey}.`>>
: never
: TObject[TKey] extends Record<string, any>
? DotObject<TObject[TKey], `${TPrefix}${TKey}.`>
: { [key in `${TPrefix}${TKey}`]: TObject[TKey] };

View file

@ -30,9 +30,12 @@ export const Routes = ({
if (React.isValidElement(child) && child.type === LegacyRoute) {
const path = replace(child?.props.path, match.url + '/', '');
const renderFunction =
// @ts-expect-error upgrade typescript v4.9.5
typeof child?.props.children === 'function'
? child?.props.children
: child?.props.render;
? // @ts-expect-error upgrade typescript v4.9.5
child?.props.children
: // @ts-expect-error upgrade typescript v4.9.5
child?.props.render;
return (
<Route
@ -40,6 +43,7 @@ export const Routes = ({
element={
<>
<MatchPropagator />
{/* @ts-expect-error upgrade typescript v4.9.5*/}
{(child?.props?.component && <child.props.component />) ||
(renderFunction && renderFunction()) ||
children}

View file

@ -143,6 +143,7 @@ export type CustomRequestHandlerMock<T> = {
};
const createCustomRequestHandlerContextMock = <T>(contextParts: T): CustomRequestHandlerMock<T> => {
// @ts-expect-error upgrade typescript v4.9.5
const mock = Object.entries(contextParts).reduce(
(context, [key, value]) => {
// @ts-expect-error type matching from inferred types is hard

View file

@ -72,7 +72,7 @@ export const FetchAgentVersionsList: Task = {
const versionsList = await getAvailableVersions(log);
const AGENT_VERSION_BUILD_FILE = 'x-pack/plugins/fleet/target/agent_versions_list.json';
if (versionsList !== []) {
if (versionsList.length !== 0) {
log.info(`Writing versions list to ${AGENT_VERSION_BUILD_FILE}`);
await write(
build.resolvePath(AGENT_VERSION_BUILD_FILE),

View file

@ -61,9 +61,6 @@ x-pack/plugins/lens/public/datatable_visualization/expression.tsx kibana-app
x-pack/plugins/lens/public/datatable_visualization/index.ts kibana-app
x-pack/plugins/lens/public/datatable_visualization/visualization.test.tsx kibana-app
x-pack/plugins/lens/public/datatable_visualization/visualization.tsx kibana-app
x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx kibana-app
x-pack/plugins/lens/public/debounced_component/debounced_component.tsx kibana-app
x-pack/plugins/lens/public/debounced_component/index.ts kibana-app
x-pack/plugins/lens/public/drag_drop/drag_drop.test.tsx kibana-app
x-pack/plugins/lens/public/drag_drop/drag_drop.tsx kibana-app
x-pack/plugins/lens/public/drag_drop/index.ts kibana-app

View file

@ -10,7 +10,7 @@ import React from 'react';
import { storiesOf } from '@storybook/react';
import { from } from 'rxjs';
import { ExpressionValueVisDimension } from '@kbn/visualizations-plugin/common';
import { Datatable, DatatableColumn } from '@kbn/expressions-plugin/common';
import { Datatable, DatatableColumn, TextAlignment } from '@kbn/expressions-plugin/common';
import { Render } from '@kbn/presentation-util-plugin/public/__stories__';
import { ColorMode, CustomPaletteState } from '@kbn/charts-plugin/common';
import { getFormatService } from '../__mocks__/format_service';
@ -209,7 +209,11 @@ storiesOf('renderers/visMetric', module)
},
labels: {
show: false,
style: { spec: { fontSize: '60px', align: 'left' }, type: 'style', css: '' },
style: {
spec: { fontSize: '60px', textAlign: TextAlignment.LEFT },
type: 'style',
css: '',
},
position: LabelPosition.TOP,
},
},

View file

@ -63,10 +63,13 @@ function hasAutoscaleProps<T>(props: T): props is T & AutoScaleProps {
return false;
}
function getWrappedComponentProps<T>(props: T) {
function getWrappedComponentProps<T>(props: T): T {
if (hasAutoscaleProps(props)) {
const { autoScaleParams, renderComplete, ...rest } = props;
return rest;
return {
...props,
autoScaleParams: undefined,
renderComplete: undefined,
};
}
return props;
@ -132,7 +135,7 @@ export function withAutoScale<T>(WrappedComponent: ComponentType<T>) {
: {}),
}}
>
<WrappedComponent {...(restProps as T)} />
<WrappedComponent {...restProps} />
</div>
</div>
);

View file

@ -21,6 +21,7 @@ export function createComponentWithContext<Props = Record<string, any>>(
services: PropTypes.object,
};
// @ts-expect-error upgrade typescript v4.9.5
return shallow(<MyComponent {...props} />, {
context: {
services: mockedContext,

View file

@ -65,6 +65,7 @@ export interface EmbeddableFactory<
*/
readonly isEditable: () => Promise<boolean>;
// @ts-expect-error upgrade typescript v4.9.5
readonly savedObjectMetaData?: SavedObjectMetaData<TSavedObjectAttributes>;
/**

View file

@ -9,6 +9,7 @@
import { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
type SavedObjectToPanelMethod<TSavedObjectAttributes, TByValueInput> = (
// @ts-expect-error upgrade typescript v4.9.5
savedObject: SavedObjectCommon<TSavedObjectAttributes>
) => { savedObjectId: string } | Partial<TByValueInput>;

View file

@ -13,6 +13,7 @@ import { useFieldFromProps } from '../hooks';
export interface Props<T, FormType = FormData, I = T> {
path: string;
// @ts-expect-error upgrade typescript v4.9.5
config?: FieldConfig<T, FormType, I>;
defaultValue?: T;
component?: FunctionComponent<any>;

View file

@ -31,8 +31,10 @@ const errorsToString = (errors: ValidationError[]): string[] | null => {
};
export const useField = <T, FormType = FormData, I = T>(
// @ts-expect-error upgrade typescript v4.9.5
form: FormHook<FormType>,
path: string,
// @ts-expect-error upgrade typescript v4.9.5
config: FieldConfig<T, FormType, I> & InternalFieldConfig<T>,
valueChangeListener?: (value: I) => void,
errorChangeListener?: (errors: string[] | null) => void,
@ -231,7 +233,7 @@ export const useField = <T, FormType = FormData, I = T>(
// -- helpers
const doByPassValidation = ({
type: validationType,
isBlocking,
isBlocking, // @ts-expect-error upgrade typescript v4.9.5
}: ValidationConfig<FormType, string, I>) => {
if (validationType !== undefined && validationType !== validationTypeToValidate) {
return true;
@ -246,6 +248,7 @@ export const useField = <T, FormType = FormData, I = T>(
const enhanceValidationError = (
validationError: ValidationError,
// @ts-expect-error upgrade typescript v4.9.5
validation: ValidationConfig<FormType, string, I>,
validationType: string
) => ({
@ -275,6 +278,7 @@ export const useField = <T, FormType = FormData, I = T>(
inflightValidation.current = validator({
value: valueToValidate,
errors: validationErrors,
// @ts-expect-error upgrade typescript v4.9.5
form: { getFormData, getFields },
formData,
path,
@ -318,6 +322,7 @@ export const useField = <T, FormType = FormData, I = T>(
const validationResult = validator({
value: valueToValidate,
errors: validationErrors,
// @ts-expect-error upgrade typescript v4.9.5
form: { getFormData, getFields },
formData,
path,

View file

@ -21,6 +21,7 @@ import { useField, InternalFieldConfig } from './use_field';
export const useFieldFromProps = <T, FormType, I>(
props: UseFieldProps<T, FormType, I>
): { field: FieldHook<T, I>; propsToForward: { [x: string]: unknown } } => {
// @ts-expect-error upgrade typescript v4.9.5
const form = useFormContext<FormType>();
const { getFieldDefaultValue, __readFieldConfigFromSchema, __updateDefaultValueAt } = form;
@ -71,6 +72,7 @@ export const useFieldFromProps = <T, FormType, I>(
return value === undefined ? ('' as unknown as T) : value;
}, [defaultValue, path, config, readDefaultValueOnForm, getFieldDefaultValue]);
// @ts-expect-error upgrade typescript v4.9.5
const fieldConfig = useMemo<FieldConfig<T, FormType, I> & InternalFieldConfig<T>>(
() => ({
...config,

View file

@ -101,6 +101,7 @@ export interface FormHook<T extends FormData = FormData, I extends FormData = T>
InternalFieldType = FieldType
>(
fieldPath: string
// @ts-expect-error upgrade typescript v4.9.5
) => FieldConfig<FieldType, FormType, InternalFieldType> | undefined;
__getFormDefaultValue: () => I | undefined;
__getFieldsRemoved: () => FieldsMap;

View file

@ -17,7 +17,11 @@ import { ExpressionAstExpression } from '../ast';
* `ExecutionContract` is a wrapper around `Execution` class. It provides the
* same functionality but does not expose Expressions plugin internals.
*/
export class ExecutionContract<Input = unknown, Output = unknown, InspectorAdapters = unknown> {
export class ExecutionContract<
Input = unknown,
Output = unknown,
InspectorAdapters extends Adapters = object
> {
public get isPending(): boolean {
const { state, result } = this.execution.state.get();
const finished = state === 'error' || (state === 'result' && !result?.partial);

View file

@ -26,6 +26,7 @@ export function enhanceRouter({ router, fileKind }: Args): FileKindRouter {
const handlerWrapper: (handler: FileKindHandler) => FileKindHandler =
(handler) => async (ctx, req, res) => {
return handler(
// @ts-expect-error upgrade typescript v4.9.5
Object.create(ctx, { fileKind: { value: fileKind, enumerable: true, writeable: false } }),
req,
res

View file

@ -41,6 +41,7 @@ export type FilesRequestHandler<
Method extends RouteMethod = any
> = RequestHandler<P, Q, B, FilesRequestHandlerContext, Method, KibanaResponseFactory>;
// @ts-expect-error upgrade typescript v4.9.5
export type AsyncResponse<T> = Promise<IKibanaResponse<T>>;
export type CreateHandler<E extends AnyEndpoint> = FilesRequestHandler<

View file

@ -128,7 +128,7 @@ export function useFormState<Values extends FormValues, Result>({
const [touched, setTouched] = useState<TouchedFields<Values>>({});
const [submitCount, setSubmitCount] = useState(0);
async function validateFormFn(formValues: Values): Promise<Result>;
async function validateFormFn(formValues: Values): Promise<DeepMap<Values, string>>;
async function validateFormFn(formValues: undefined): Promise<undefined>;
async function validateFormFn(formValues: Values | undefined) {
// Allows resetting `useAsyncFn` state

View file

@ -18,6 +18,7 @@ import { PluginServiceFactory } from './factory';
*/
export type PluginServiceProviders<Services, StartParameters = {}> = {
[K in keyof Services]: PluginServiceProvider<
// @ts-expect-error upgrade typescript v4.9.5
Services[K],
StartParameters,
Services,

View file

@ -350,7 +350,8 @@ export const UnifiedHistogramLayout = ({
</InPortal>
<InPortal node={mainPanelNode}>
{React.isValidElement(children)
? React.cloneElement(children, { isChartAvailable })
? // @ts-expect-error upgrade typescript v4.9.5
React.cloneElement(children, { isChartAvailable })
: children}
</InPortal>
<ResizableLayout

View file

@ -13,6 +13,7 @@ import { FormattedColumn, TableVisConfig, TableVisUiState } from '../types';
import { DatatableColumn } from '@kbn/expressions-plugin/common';
import { createTableVisCell } from './table_vis_cell';
import { createGridColumns } from './table_vis_columns';
import { EuiDataGridProps } from '@elastic/eui';
jest.mock('./table_vis_columns', () => ({
createGridColumns: jest.fn(() => []),
@ -107,7 +108,8 @@ describe('TableVisBasic', () => {
undefined
);
const { onSort } = comp.find('EuiDataGrid').prop('sorting');
const { onSort } = comp.find('EuiDataGrid').prop<EuiDataGridProps['sorting']>('sorting')!;
// sort the first column
onSort([{ id: 'first', direction: 'asc' }]);
expect(uiStateProps.setSort).toHaveBeenCalledWith({ columnIndex: 0, direction: 'asc' });

View file

@ -49,18 +49,20 @@ export const convertToPercentileColumn = (
return null;
}
const commonColumnParams = createColumn(series, metric, field, { reducedTimeRange, timeShift });
const meta: PercentileColumn['meta'] =
index !== undefined
? {
reference: `${metric.id}.${index}`,
...commonColumnParams.meta,
}
: commonColumnParams.meta;
return {
operationType: 'percentile',
sourceField: field.name,
...commonColumnParams,
params: { ...params, ...getFormat(series) },
meta:
index !== undefined
? {
reference: `${metric.id}.${index}`,
...commonColumnParams.meta,
}
: commonColumnParams.meta,
meta,
};
};

View file

@ -19,6 +19,7 @@ import {
Column,
PercentileRanksColumnWithExtendedMeta,
CommonColumnConverterArgs,
PercentileColumn,
} from './types';
export const isPercentileRanksColumnWithMeta = (
@ -56,18 +57,19 @@ export const convertToPercentileRankColumn = (
}
const commonColumnParams = createColumn(series, metric, field, { reducedTimeRange, timeShift });
const meta: PercentileColumn['meta'] =
index !== undefined
? {
reference: `${metric.id}.${index}`,
...commonColumnParams.meta,
}
: commonColumnParams.meta;
return {
operationType: 'percentile_rank',
sourceField: field.name,
...commonColumnParams,
params: { ...params, ...getFormat(series) },
meta:
index !== undefined
? {
reference: `${metric.id}.${index}`,
...commonColumnParams.meta,
}
: commonColumnParams.meta,
meta,
};
};

View file

@ -8,7 +8,7 @@
import type { DataView } from '@kbn/data-views-plugin/common';
import { IAggConfig, METRIC_TYPES, TimefilterContract } from '@kbn/data-plugin/public';
import { AggBasedColumn, PercentageModeConfig, SchemaConfig } from '../../common';
import { AggBasedColumn, PercentageModeConfig, SchemaConfig, VisParams } from '../../common';
import { convertMetricToColumns } from '../../common/convert_to_lens/lib/metrics';
import {
getAggIdAndValue,
@ -133,8 +133,8 @@ const createLayer = (
};
};
export const getColumnsFromVis = <T>(
vis: Vis<T>,
export const getColumnsFromVis = <TVisParams extends VisParams>(
vis: Vis<TVisParams>,
timefilter: TimefilterContract,
dataView: DataView,
{

View file

@ -80,7 +80,7 @@ export interface VisToExpressionAstParams {
abortSignal?: AbortSignal;
}
export type VisToExpressionAst<TVisParams = VisParams> = (
export type VisToExpressionAst<TVisParams extends VisParams = VisParams> = (
vis: Vis<TVisParams>,
params: VisToExpressionAstParams
) => Promise<ExpressionAstExpression> | ExpressionAstExpression;

View file

@ -57,7 +57,7 @@ const getSearchSource = async (inputSearchSource: ISearchSource, savedSearchId?:
type PartialVisState = Assign<SerializedVis, { data: Partial<SerializedVisData> }>;
export class Vis<TVisParams = VisParams> {
export class Vis<TVisParams extends VisParams = VisParams> {
public readonly type: BaseVisType<TVisParams>;
public readonly id?: string;
public title: string = '';

View file

@ -9,7 +9,7 @@
import type { SerializedVis } from './vis';
import type { VisParams } from '../common';
export const createVisAsync = async <TVisParams = VisParams>(
export const createVisAsync = async <TVisParams extends VisParams = VisParams>(
visType: string,
visState: SerializedVis<TVisParams> = {} as any
) => {

View file

@ -6,6 +6,7 @@
* Side Public License, v 1.
*/
import { VisParams } from '../common';
import { VisEditorConstructor } from './visualize_app/types';
const DEFAULT_NAME = 'default';
@ -17,7 +18,10 @@ export const createVisEditorsRegistry = () => {
registerDefault: (editor: VisEditorConstructor) => {
map.set(DEFAULT_NAME, editor);
},
register: <TVisParams>(name: string, editor: VisEditorConstructor<TVisParams>) => {
register: <TVisParams extends VisParams>(
name: string,
editor: VisEditorConstructor<TVisParams>
) => {
if (name) {
map.set(name, editor);
}

View file

@ -14,7 +14,7 @@ import {
} from '@kbn/data-plugin/common';
import { search } from '@kbn/data-plugin/public';
import { Vis, VisToExpressionAstParams } from './types';
import { SchemaConfig } from '../common/types';
import { SchemaConfig, VisParams } from '../common/types';
import { convertToSchemaConfig } from '../common';
const { isDateHistogramBucketAggConfig } = search.aggs;
@ -76,7 +76,7 @@ const createSchemaConfig = (
return { ...convertToSchemaConfig(updatedAgg), accessor };
};
export const getVisSchemas = <TVisParams>(
export const getVisSchemas = <TVisParams extends VisParams>(
vis: Vis<TVisParams>,
params: VisToExpressionAstParams
): Schemas => {

View file

@ -21,7 +21,7 @@ const defaultOptions: VisTypeOptions = {
hierarchicalData: false, // we should get rid of this i guess ?
};
export class BaseVisType<TVisParams = VisParams> {
export class BaseVisType<TVisParams extends VisParams = VisParams> {
public readonly name;
public readonly title;
public readonly description;

View file

@ -79,7 +79,7 @@ interface CustomEditorConfig {
* A visualization type definition representing a spec of one specific type of "classical"
* visualizations (i.e. not Lens visualizations).
*/
export interface VisTypeDefinition<TVisParams> {
export interface VisTypeDefinition<TVisParams extends VisParams> {
/**
* Visualization unique name
*/

View file

@ -10,6 +10,7 @@ import { visTypeAliasRegistry, VisTypeAlias } from './vis_type_alias_registry';
import { BaseVisType } from './base_vis_type';
import { VisTypeDefinition } from './types';
import { VisGroups } from './vis_groups_enum';
import { VisParams } from '../../common';
/**
* Vis Types Service
@ -19,7 +20,9 @@ import { VisGroups } from './vis_groups_enum';
export class TypesService {
private types: Record<string, BaseVisType<any>> = {};
private registerVisualization<TVisParam>(visDefinition: BaseVisType<TVisParam>) {
private registerVisualization<TVisParam extends VisParams>(
visDefinition: BaseVisType<TVisParam>
) {
if (this.types[visDefinition.name]) {
throw new Error('type already exists!');
}
@ -32,7 +35,9 @@ export class TypesService {
* registers a visualization type
* @param config - visualization type definition
*/
createBaseVisualization: <TVisParams>(config: VisTypeDefinition<TVisParams>): void => {
createBaseVisualization: <TVisParams extends VisParams>(
config: VisTypeDefinition<TVisParams>
): void => {
const vis = new BaseVisType(config);
this.registerVisualization(vis);
},
@ -51,7 +56,9 @@ export class TypesService {
* returns specific visualization or undefined if not found
* @param {string} visualization - id of visualization to return
*/
get: <TVisParams>(visualization: string): BaseVisType<TVisParams> | undefined => {
get: <TVisParams extends VisParams>(
visualization: string
): BaseVisType<TVisParams> | undefined => {
return this.types[visualization];
},
/**

View file

@ -137,7 +137,7 @@ export type SavedVisInstance = VisInstance;
export type ByValueVisInstance = VisInstance;
export type VisualizeEditorVisInstance = SavedVisInstance | ByValueVisInstance;
export type VisEditorConstructor<TVisParams = VisParams> = new (
export type VisEditorConstructor<TVisParams extends VisParams = VisParams> = new (
element: HTMLElement,
vis: Vis<TVisParams>,
eventEmitter: EventEmitter,

View file

@ -10,6 +10,7 @@ import React from 'react';
import { mountWithIntl } from '@kbn/test-jest-helpers';
import { TypesStart, BaseVisType, VisGroups } from '../../vis_types';
import { AggBasedSelection } from './agg_based_selection';
import { VisParams } from '../../../common';
describe('AggBasedSelection', () => {
const defaultVisTypeParams = {
@ -47,7 +48,7 @@ describe('AggBasedSelection', () => {
] as BaseVisType[];
const visTypes: TypesStart = {
get<T>(id: string): BaseVisType<T> {
get<T extends VisParams>(id: string): BaseVisType<T> {
return _visTypes.find((vis) => vis.name === id) as unknown as BaseVisType<T>;
},
all: () => _visTypes,

View file

@ -11,6 +11,7 @@ import { mountWithIntl } from '@kbn/test-jest-helpers';
import { TypesStart, BaseVisType, VisGroups } from '../../vis_types';
import { GroupSelection } from './group_selection';
import { DocLinksStart } from '@kbn/core/public';
import { VisParams } from '../../../common';
describe('GroupSelection', () => {
const defaultVisTypeParams = {
@ -61,7 +62,7 @@ describe('GroupSelection', () => {
const visTypesRegistry = (visTypes: BaseVisType[]): TypesStart => {
return {
get<T>(id: string): BaseVisType<T> {
get<T extends VisParams>(id: string): BaseVisType<T> {
return visTypes.find((vis) => vis.name === id) as unknown as BaseVisType<T>;
},
all: () => {

View file

@ -13,6 +13,7 @@ import NewVisModal from './new_vis_modal';
import { ApplicationStart, DocLinksStart } from '@kbn/core/public';
import { embeddablePluginMock } from '@kbn/embeddable-plugin/public/mocks';
import { contentManagementMock } from '@kbn/content-management-plugin/public/mocks';
import { VisParams } from '../../common';
describe('NewVisModal', () => {
const defaultVisTypeParams = {
@ -61,7 +62,7 @@ describe('NewVisModal', () => {
},
] as BaseVisType[];
const visTypes: TypesStart = {
get<T>(id: string): BaseVisType<T> {
get<T extends VisParams>(id: string): BaseVisType<T> {
return _visTypes.find((vis) => vis.name === id) as unknown as BaseVisType<T>;
},
all: () => _visTypes,

View file

@ -39,6 +39,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
await appsMenu.clickLink(title);
return browser.execute(() => {
if (!('__RENDERING_SESSION__' in window)) {
// @ts-expect-error upgrade typescript v4.9.5
window.__RENDERING_SESSION__ = [];
}

View file

@ -31,6 +31,7 @@ export function useCancellableSearch(data: DataPublicPluginStart) {
): Promise<ResponseType | null> => {
return new Promise((resolve, reject) => {
data.search
// @ts-expect-error upgrade typescript v4.9.5
.search<RequestBody, ResponseType>(requestBody, {
abortSignal: abortController.current.signal,
...options,

View file

@ -70,6 +70,7 @@ describe('FullTimeRangeSelector', () => {
const { getByText } = render(
<IntlProvider locale="en">
<DatePickerContextProvider {...mockDependencies}>
{/* @ts-expect-error upgrade typescript v4.9.5*/}
<FullTimeRangeSelector {...props} />
</DatePickerContextProvider>
</IntlProvider>
@ -98,6 +99,7 @@ describe('FullTimeRangeSelector', () => {
const { getByText } = render(
<IntlProvider locale="en">
<DatePickerContextProvider {...mockDependencies}>
{/* @ts-expect-error upgrade typescript v4.9.5*/}
<FullTimeRangeSelector {...props} />
</DatePickerContextProvider>
</IntlProvider>

View file

@ -21,6 +21,7 @@ export function useCancellableSearch() {
): Promise<ResponseType | null> => {
return new Promise((resolve, reject) => {
data.search
// @ts-expect-error upgrade typescript v4.9.5
.search<RequestBody, ResponseType>(requestBody, {
abortSignal: abortController.current.signal,
})

View file

@ -195,6 +195,7 @@ export async function createRule<Params extends RuleParams = never>(
{
legacyId,
actionsWithRefs: actions,
// @ts-expect-error upgrade typescript v4.9.5
paramsWithRefs: updatedParams,
}
);

View file

@ -6,4 +6,5 @@
*/
import type { Rule } from '../../../types';
// @ts-expect-error upgrade typescript v4.9.5
export type ResolvedRule<Params> = Rule<Params> & { outcome: string; alias_target_id?: string };

View file

@ -48,6 +48,7 @@ describe('getRuleRoute', () => {
alertsFilter: {
query: {
kql: 'name:test',
// @ts-expect-error upgrade typescript v4.9.5
dsl: '{"must": {"term": { "name": "test" }}}',
filters: [],
},

View file

@ -43,6 +43,7 @@ const sampleRule: SanitizedRule<RuleTypeParams> & { activeSnoozes?: string[] } =
notifyWhen: 'onThrottleInterval',
throttle: '1m',
},
// @ts-expect-error upgrade typescript v4.9.5
alertsFilter: { query: { kql: 'test:1', dsl: '{}', filters: [] } },
},
],

View file

@ -55,6 +55,7 @@ describe('createRuleRoute', () => {
alertsFilter: {
query: {
kql: 'name:test',
// @ts-expect-error upgrade typescript v4.9.5
dsl: '{"must": {"term": { "name": "test" }}}',
filters: [],
},

View file

@ -28,7 +28,7 @@ const columnExists = (cols: string[], colName: string): boolean =>
cols.includes(unquoteString(colName));
function keysOf<T, K extends keyof T>(obj: T): K[] {
return Object.keys(obj) as K[];
return Object.keys(obj as any) as K[];
}
type Arguments = { [key in PointSeriesColumnName]: string | null };

View file

@ -652,6 +652,7 @@ export const status: CanvasTemplate = {
},
expression:
'demodata\n| dropdownControl valueColumn="project" filterColumn="project"\n| render',
// @ts-expect-error upgrade typescript v4.9.5
filter: '',
},
],

View file

@ -324,6 +324,7 @@ export const summary: CanvasTemplate = {
},
expression:
'timefilterControl compact=true column="@timestamp"\n| render css=".canvasTimePickerPopover__button {\n border: none !important;\n}"',
// @ts-expect-error upgrade typescript v4.9.5
filter: 'timefilter from="now-14d" to=now column=@timestamp',
},
{

View file

@ -38,6 +38,7 @@ export interface ArgumentSpec<ArgumentConfig = {}> {
domNode: HTMLElement,
config: ArgumentConfig,
handlers: ArgumentHandlers,
// @ts-expect-error upgrade typescript v4.9.5
onMount: (ref: UpdatePropsRef<ArgumentConfig> | null) => void
) => void;
/**
@ -48,6 +49,7 @@ export interface ArgumentSpec<ArgumentConfig = {}> {
domNode: HTMLElement,
config: ArgumentConfig,
handlers: ArgumentHandlers,
// @ts-expect-error upgrade typescript v4.9.5
onMount: (ref: UpdatePropsRef<ArgumentConfig> | null) => void
) => void;
}

View file

@ -72,6 +72,7 @@ import type { initFunctions as initClientFunctions } from '../public/functions';
*/
// prettier-ignore
export type ExpressionFunctionFactory<Name extends string, Input, Arguments, Output> =
// @ts-expect-error upgrade typescript v4.9.5
() => ExpressionFunctionDefinition<Name, Input, Arguments, Output>
/**
@ -83,6 +84,7 @@ export type ExpressionFunctionFactory<Name extends string, Input, Arguments, Out
// prettier-ignore
export type FunctionFactory<FnFactory> =
FnFactory extends ExpressionFunctionFactory<infer Name, infer Input, infer Arguments, infer Output> ?
// @ts-expect-error upgrade typescript v4.9.5
ExpressionFunctionDefinition<Name, Input, Arguments, Awaited<Output>> :
never;

View file

@ -39,7 +39,7 @@ export const convertArrayToCamelCase = (arrayOfSnakes: unknown[]): unknown[] =>
}, []);
export const convertToCamelCase = <T, U extends {}>(obj: T): U =>
Object.entries(obj).reduce((acc, [key, value]) => {
Object.entries(obj as never).reduce((acc, [key, value]) => {
if (isArray(value)) {
set(acc, camelCase(key), convertArrayToCamelCase(value));
} else if (isObject(value)) {

View file

@ -147,6 +147,7 @@ describe('UserList ', () => {
username: null,
email: null,
full_name: null,
// @ts-expect-error upgrade typescript v4.9.5
uid: null,
},
},

View file

@ -509,7 +509,9 @@ const fetchComparisonDriftedData = async ({
);
fieldsWithNoOverlap.forEach((field) => {
// @ts-expect-error upgrade typescript v4.9.5
if (driftedResp.aggregations) {
// @ts-expect-error upgrade typescript v4.9.5
driftedResp.aggregations[`${field}_ks_test`] = {
// Setting -Infinity to represent astronomically small number
// which would be represented as < 0.000001 in table
@ -801,6 +803,7 @@ export const useFetchDataComparisonResult = (
randomSamplerWrapper,
asyncFetchFn: (chunkedFields) =>
// @ts-expect-error upgrade typescript v4.9.5
fetchReferenceBaselineData({
dataSearch,
baseRequest: baselineRequest,
@ -862,6 +865,7 @@ export const useFetchDataComparisonResult = (
fields,
randomSamplerWrapper: prodRandomSamplerWrapper,
// @ts-expect-error upgrade typescript v4.9.5
asyncFetchFn: (chunkedFields: DataDriftField[]) =>
fetchComparisonDriftedData({
dataSearch,
@ -904,11 +908,14 @@ export const useFetchDataComparisonResult = (
fields,
randomSamplerWrapper,
// @ts-expect-error upgrade typescript v4.9.5
asyncFetchFn: (chunkedFields: DataDriftField[]) =>
fetchHistogramData({
dataSearch,
baseRequest: referenceHistogramRequest,
// @ts-expect-error upgrade typescript v4.9.5
baselineResponseAggs,
// @ts-expect-error upgrade typescript v4.9.5
driftedRespAggs,
fields: chunkedFields,
randomSamplerWrapper,
@ -946,11 +953,14 @@ export const useFetchDataComparisonResult = (
fields,
randomSamplerWrapper,
// @ts-expect-error upgrade typescript v4.9.5
asyncFetchFn: (chunkedFields: DataDriftField[]) =>
fetchHistogramData({
dataSearch,
baseRequest: comparisonHistogramRequest,
// @ts-expect-error upgrade typescript v4.9.5
baselineResponseAggs,
// @ts-expect-error upgrade typescript v4.9.5
driftedRespAggs,
fields: chunkedFields,
randomSamplerWrapper,
@ -972,30 +982,42 @@ export const useFetchDataComparisonResult = (
for (const { field, type, secondaryType } of fields) {
if (
type === DATA_COMPARISON_TYPE.NUMERIC &&
// @ts-expect-error upgrade typescript v4.9.5
driftedRespAggs[`${field}_ks_test`] &&
// @ts-expect-error upgrade typescript v4.9.5
referenceHistogramRespAggs[`${field}_histogram`] &&
// @ts-expect-error upgrade typescript v4.9.5
comparisonHistogramRespAggs[`${field}_histogram`]
) {
data[field] = {
secondaryType,
type: DATA_COMPARISON_TYPE.NUMERIC,
// @ts-expect-error upgrade typescript v4.9.5
pValue: driftedRespAggs[`${field}_ks_test`].two_sided,
// @ts-expect-error upgrade typescript v4.9.5
referenceHistogram: referenceHistogramRespAggs[`${field}_histogram`].buckets,
// @ts-expect-error upgrade typescript v4.9.5
comparisonHistogram: comparisonHistogramRespAggs[`${field}_histogram`].buckets,
};
}
if (
type === DATA_COMPARISON_TYPE.CATEGORICAL &&
// @ts-expect-error upgrade typescript v4.9.5
driftedRespAggs[`${field}_terms`] &&
// @ts-expect-error upgrade typescript v4.9.5
baselineResponseAggs[`${field}_terms`]
) {
data[field] = {
secondaryType,
type: DATA_COMPARISON_TYPE.CATEGORICAL,
// @ts-expect-error upgrade typescript v4.9.5
driftedTerms: driftedRespAggs[`${field}_terms`].buckets ?? [],
// @ts-expect-error upgrade typescript v4.9.5
driftedSumOtherDocCount: driftedRespAggs[`${field}_terms`].sum_other_doc_count,
// @ts-expect-error upgrade typescript v4.9.5
baselineTerms: baselineResponseAggs[`${field}_terms`].buckets ?? [],
baselineSumOtherDocCount:
// @ts-expect-error upgrade typescript v4.9.5
baselineResponseAggs[`${field}_terms`].sum_other_doc_count,
};
}

View file

@ -41,10 +41,13 @@ export class ResponseFactory {
constructor(private response: KibanaResponseFactory) {}
/** error */
// @ts-expect-error upgrade typescript v4.9.5
error<T>({ statusCode, body, headers }: CustomHttpResponseOptions<T>) {
// @ts-expect-error upgrade typescript v4.9.5
const contentType: CustomHttpResponseOptions<T>['headers'] = {
'content-type': 'application/json',
};
// @ts-expect-error upgrade typescript v4.9.5
const defaultedHeaders: CustomHttpResponseOptions<T>['headers'] = {
...contentType,
...(headers ?? {}),

View file

@ -41,10 +41,13 @@ export class ResponseFactory {
constructor(private response: KibanaResponseFactory) {}
/** error */
// @ts-expect-error upgrade typescript v4.9.5
error<T>({ statusCode, body, headers }: CustomHttpResponseOptions<T>) {
// @ts-expect-error upgrade typescript v4.9.5
const contentType: CustomHttpResponseOptions<T>['headers'] = {
'content-type': 'application/json',
};
// @ts-expect-error upgrade typescript v4.9.5
const defaultedHeaders: CustomHttpResponseOptions<T>['headers'] = {
...contentType,
...(headers ?? {}),

View file

@ -38,6 +38,7 @@ export const ConnectorTotalStats: React.FC = () => {
const stats: EuiStatProps[] & { 'data-test-subj'?: string } = [
{
// @ts-expect-error upgrade typescript v4.9.5
'data-test-subj': 'entSearchContent-indexOverview-totalStats-ingestionType',
description: i18n.translate(
'xpack.enterpriseSearch.content.searchIndex.totalStats.ingestionTypeCardLabel',
@ -54,6 +55,7 @@ export const ConnectorTotalStats: React.FC = () => {
),
},
{
// @ts-expect-error upgrade typescript v4.9.5
'data-test-subj': 'entSearchContent-indexOverview-totalStats-connectorType',
description: i18n.translate('xpack.enterpriseSearch.connector.connectorTypePanel.title', {
defaultMessage: 'Connector type',

View file

@ -31,6 +31,7 @@ export const CrawlerTotalStats: React.FC = () => {
const stats: EuiStatProps[] & { 'data-test-subj'?: string } = [
{
// @ts-expect-error upgrade typescript v4.9.5
'data-test-subj': 'entSearchContent-indexOverview-totalStats-ingestionType',
description: i18n.translate(
'xpack.enterpriseSearch.content.searchIndex.totalStats.ingestionTypeCardLabel',
@ -57,6 +58,7 @@ export const CrawlerTotalStats: React.FC = () => {
title: domains.length,
},
{
// @ts-expect-error upgrade typescript v4.9.5
'data-test-subj': 'entSearchContent-indexOverview-totalStats-documentCount',
description: i18n.translate(
'xpack.enterpriseSearch.content.searchIndex.totalStats.documentCountCardLabel',

View file

@ -52,6 +52,7 @@ export const IndexPipelinesConfigurationsLogic = kea<
},
events: ({ actions, values }) => ({
afterMount: () => {
// @ts-expect-error upgrade typescript v4.9.5
if (!values.indexPipelinesData || values.indexPipelinesData.length === 0) {
return;
}

View file

@ -29,6 +29,7 @@ describe('AccordionList', () => {
it('renders as an accordion with the passed in title and icon', () => {
expect(wrapper.is(EuiAccordion)).toBe(true);
// @ts-expect-error upgrade typescript v4.9.5
const buttonContent = shallow(wrapper.prop('buttonContent'));
expect(buttonContent.find(EuiIcon).prop('type')).toEqual('globe');
@ -36,6 +37,7 @@ describe('AccordionList', () => {
});
it('shows the item count', () => {
// @ts-expect-error upgrade typescript v4.9.5
const extraActionContent = shallow(wrapper.prop('extraAction'));
expect(extraActionContent.text()).toEqual('2');

View file

@ -19,6 +19,7 @@ export const item: GetInfoResponse['item'] = {
icons: [
{
src: '/img/logo_nginx.svg',
// @ts-expect-error upgrade typescript v4.9.5
path: '/package/nginx/0.7.0/img/logo_nginx.svg',
title: 'logo nginx',
size: '32x32',

View file

@ -21,7 +21,7 @@ import { ENDPOINT_PRIVILEGES } from './constants';
const SECURITY_SOLUTION_ID = DEFAULT_APP_CATEGORIES.security.id;
function generateActions<T>(privileges: T, overrides: Record<string, boolean> = {}) {
return Object.keys(privileges).reduce((acc, privilege) => {
return Object.keys(privileges as any).reduce((acc, privilege) => {
const executePackageAction = overrides[privilege] || false;
return {

View file

@ -56,6 +56,7 @@ export function useConfirmModal() {
export function withConfirmModalProvider<T>(WrappedComponent: React.FunctionComponent<T>) {
return (props: T) => (
<ConfirmModalProvider>
{/* @ts-expect-error upgrade typescript v4.9.5*/}
<WrappedComponent {...props} />
</ConfirmModalProvider>
);

View file

@ -305,6 +305,7 @@ export async function ensurePreconfiguredPackagesAndPolicies(
}),
}
),
// @ts-expect-error upgrade typescript v4.9.5
packages: fulfilledPackages.map((pkg) => ('version' in pkg ? pkgToPkgKey(pkg) : pkg.name)),
nonFatalErrors: [...rejectedPackages, ...rejectedPolicies],
};

View file

@ -86,6 +86,7 @@ export const FormErrorsProvider: FunctionComponent = ({ children }) => {
const nextHasErrors =
Object.keys(restOfPhaseErrors).length > 0 ||
Object.values(otherPhases).some((phaseErrors) => {
// @ts-expect-error upgrade typescript v4.9.5
return Object.keys(phaseErrors).length > 0;
});

View file

@ -148,6 +148,7 @@ export const withSourceProvider =
return function ComponentWithSourceProvider(props: ComponentProps) {
return (
<SourceProvider sourceId={sourceId}>
{/* @ts-expect-error upgrade typescript v4.9.5*/}
<Component {...props} />
</SourceProvider>
);

View file

@ -65,6 +65,7 @@ export const Section: FunctionComponent<SectionProps> = ({
const childrenWithProps = Children.map(children, (child) =>
isValidElement(child)
? cloneElement(child, {
// @ts-expect-error upgrade typescript v4.9.5
metrics,
onChangeRangeTime,
isLiveStreaming,

View file

@ -33,6 +33,7 @@ export const SubSection: FunctionComponent<SubSectionProps> = ({
const childrenWithProps = Children.map(children, (child) => {
if (isValidElement(child)) {
return cloneElement(child, {
// @ts-expect-error upgrade typescript v4.9.5
metric,
id,
onChangeRangeTime,

View file

@ -56,10 +56,12 @@ const operationDefinitionMap: Record<string, GenericOperationDefinition> = {
}),
derivative: createOperationDefinitionMock('derivative', { input: 'fullReference' }),
moving_average: createOperationDefinitionMock('moving_average', {
// @ts-expect-error upgrade typescript v4.9.5
input: 'fullReference',
operationParams: [{ name: 'window', type: 'number', required: true }],
filterable: true,
getErrorMessage: jest.fn(() => ['mock error']),
// @ts-expect-error upgrade typescript v4.9.5
buildColumn: ({ referenceIds }, columnsParams) => ({
label: 'moving_average',
dataType: 'number',

View file

@ -1,33 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import { mountWithIntl as mount } from '@kbn/test-jest-helpers';
import { debouncedComponent } from './debounced_component';
import { act } from 'react-dom/test-utils';
describe('debouncedComponent', () => {
test('immediately renders', () => {
const TestComponent = debouncedComponent(({ title }: { title: string }) => {
return <h1>{title}</h1>;
});
expect(mount(<TestComponent title="hoi" />).html()).toMatchInlineSnapshot(`"<h1>hoi</h1>"`);
});
test('debounces changes', async () => {
const TestComponent = debouncedComponent(({ title }: { title: string }) => {
return <h1>{title}</h1>;
}, 1);
const component = mount(<TestComponent title="there" />);
component.setProps({ title: 'yall' });
expect(component.text()).toEqual('there');
await act(async () => {
await new Promise((r) => setTimeout(r, 10));
});
expect(component.text()).toEqual('yall');
});
});

View file

@ -1,29 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React, { useState, useMemo, useEffect, memo, FunctionComponent } from 'react';
import { debounce } from 'lodash';
/**
* debouncedComponent wraps the specified React component, returning a component which
* only renders once there is a pause in props changes for at least `delay` milliseconds.
* During the debounce phase, it will return the previously rendered value.
*/
export function debouncedComponent<TProps>(component: FunctionComponent<TProps>, delay = 256) {
const MemoizedComponent = memo(component) as unknown as FunctionComponent<TProps>;
return (props: TProps) => {
const [cachedProps, setCachedProps] = useState(props);
const debouncePropsChange = useMemo(() => debounce(setCachedProps, delay), [setCachedProps]);
// cancel debounced prop change if component has been unmounted in the meantime
useEffect(() => () => debouncePropsChange.cancel(), [debouncePropsChange]);
debouncePropsChange(props);
return React.createElement(MemoizedComponent, cachedProps);
};
}

View file

@ -1,8 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export * from './debounced_component';

View file

@ -18,11 +18,6 @@ import {
} from '../../../mocks';
import { mockDataPlugin, mountWithProvider } from '../../../mocks';
jest.mock('../../../debounced_component', () => {
return {
debouncedComponent: (fn: unknown) => fn,
};
});
import { WorkspacePanel } from './workspace_panel';
import { ReactWrapper } from 'enzyme';

View file

@ -777,6 +777,7 @@ export const VisualizationWrapper = ({
searchSessionId={searchSessionId}
onEvent={onEvent}
hasCompatibleActions={hasCompatibleActions}
// @ts-expect-error upgrade typescript v4.9.5
onData$={onData$}
onRender$={onRenderHandler}
inspectorAdapters={lensInspector.adapters}

View file

@ -86,6 +86,7 @@ export function ExpressionWrapper({
interactive={interactive}
searchContext={searchContext}
searchSessionId={searchSessionId}
// @ts-expect-error upgrade typescript v4.9.5
onData$={onData$}
onRender$={onRender$}
inspectorAdapters={lensInspector.adapters}

View file

@ -877,7 +877,7 @@ export const makeLensReducer = (storeDeps: LensStoreDeps) => {
activeVisualization.removeLayer &&
state.visualization.state
) {
const updater = layerIds.reduce(
const updater = layerIds.reduce<unknown>(
(acc, layerId) =>
activeVisualization.removeLayer ? activeVisualization.removeLayer(acc, layerId) : acc,
state.visualization.state

View file

@ -502,7 +502,11 @@ export const commonMigratePartitionChartGroups = (
}>
): LensDocShape850<{
shape: string;
layers: Array<{ primaryGroups?: string[]; secondaryGroups?: string[] }>;
layers: Array<{
primaryGroups?: string[];
secondaryGroups?: string[];
[key: string]: unknown; // unknown carryover key/values
}>;
}> => {
if (
attributes.state.visualization?.layers &&

View file

@ -48,12 +48,15 @@ const statusToErrorMessage = (
export class SiemResponseFactory {
constructor(private response: KibanaResponseFactory) {}
// @ts-expect-error upgrade typescript v4.9.5
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
error<T>({ statusCode, body, headers, bypassErrorFormat }: CustomHttpResponseOptions<T>) {
// KibanaResponse is not exported so we cannot use a return type here and that is why the linter is turned off above
// @ts-expect-error upgrade typescript v4.9.5
const contentType: CustomHttpResponseOptions<T>['headers'] = {
'content-type': 'application/json',
};
// @ts-expect-error upgrade typescript v4.9.5
const defaultedHeaders: CustomHttpResponseOptions<T>['headers'] = {
...contentType,
...(headers ?? {}),

View file

@ -104,6 +104,7 @@ export class VerticalScrollPanel<Child> extends React.PureComponent<
},
} = this;
// @ts-expect-error upgrade typescript v4.9.5
return getVisibleChildren(Array.from(childDimensions.entries()), scrollViewHeight, scrollTop);
};
@ -135,8 +136,11 @@ export class VerticalScrollPanel<Child> extends React.PureComponent<
}
onVisibleChildrenChange({
// @ts-expect-error upgrade typescript v4.9.5
bottomChild: visibleChildren.bottomChild,
// @ts-expect-error upgrade typescript v4.9.5
middleChild: visibleChildren.middleChild,
// @ts-expect-error upgrade typescript v4.9.5
topChild: visibleChildren.topChild,
fromScroll,
...scrollPosition,
@ -205,6 +209,7 @@ export class VerticalScrollPanel<Child> extends React.PureComponent<
if (visibleChildren) {
return {
scrollOffset: visibleChildren.middleChildOffset,
// @ts-expect-error upgrade typescript v4.9.5
scrollTarget: visibleChildren.middleChild,
};
}

View file

@ -185,9 +185,11 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource
const buffer: MapExtent =
'isGeoGridPrecisionAware' in this &&
'getGeoGridPrecision' in this &&
// @ts-expect-error upgrade typescript v4.9.5
(this as IESAggSource).isGeoGridPrecisionAware()
? expandToTileBoundaries(
requestMeta.buffer,
// @ts-expect-error upgrade typescript v4.9.5
(this as IESAggSource).getGeoGridPrecision(requestMeta.zoom)
)
: requestMeta.buffer;

View file

@ -350,6 +350,7 @@ export class DynamicStyleProperty<T>
}
getDataMappingFunction() {
// @ts-expect-error upgrade typescript v4.9.5
return 'dataMappingFunction' in this._options
? (this._options as T & { dataMappingFunction: DATA_MAPPING_FUNCTION }).dataMappingFunction
: DATA_MAPPING_FUNCTION.INTERPOLATE;

Some files were not shown because too many files have changed in this diff Show more