From 37ec1e1053620b8bd3c294a10571f952c841a71d Mon Sep 17 00:00:00 2001 From: Mikhail Shustov Date: Thu, 27 Aug 2020 11:28:02 +0300 Subject: [PATCH] Update to TS v4 (#73924) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * bump ts to v4 * MOAR RAM * fix type errors for OSS * first pass on x-pack errors * second pass on x-pack type errors * 3rd pass on x-pack type-errors * mute errors if complex cases * don't delete if spread suffices * mute other complex cases * make User fields optional * fix optional types * fix tests * fix typings for time_range * fix type errors in x-pack/tests * rebuild kbn-pm * remove leftovers from master update * fix alert tests * [Telemetry Checker] TS4 Fixes * bump to 4.0.1-rc * fix new errors in master * bump typescript-eslint to version supporting TS v4 syntax * fix merge commit errors * update to the stable TS version 4.0.2 * bump ts-eslint to version supporting ts v4 * fix typo * fix type errors after merge * update ts in another new package.json * TEMP: remove me * Revert "TEMP: remove me" This reverts commit dc0fc3bae67a5eab43af06cf9fec80119966d3fc. * [Telemetry] Update snapshot for new TS4 SyntaxKind * bump prettier to support TS v4 syntax * fix prettier rules * last style change * fix new type errors Co-authored-by: Alejandro Fernández Haro --- .../public/book/book_embeddable.tsx | 3 +- package.json | 12 +-- packages/eslint-config-kibana/package.json | 4 +- packages/kbn-analytics/package.json | 2 +- packages/kbn-config-schema/package.json | 2 +- packages/kbn-dev-utils/package.json | 2 +- packages/kbn-i18n/package.json | 2 +- packages/kbn-monaco/package.json | 2 +- packages/kbn-plugin-generator/package.json | 2 +- packages/kbn-plugin-helpers/package.json | 2 +- packages/kbn-pm/dist/index.js | 1 + packages/kbn-pm/package.json | 4 +- packages/kbn-release-notes/package.json | 4 +- packages/kbn-spec-to-console/package.json | 2 +- packages/kbn-telemetry-tools/package.json | 2 +- .../extract_collectors.test.ts.snap | 30 +++---- .../src/tools/serializer.ts | 17 ++-- src/fixtures/agg_resp/date_histogram.js | 2 +- src/fixtures/agg_resp/range.js | 2 +- src/legacy/server/status/lib/metrics.test.js | 8 +- .../management_app/advanced_settings.tsx | 2 +- .../__jest__/url_autocomplete.test.js | 18 ++-- src/plugins/dashboard/common/bwc/types.ts | 2 +- .../application/dashboard_app_controller.tsx | 1 + .../common/es_query/kuery/ast/ast.test.ts | 4 +- .../embeddable/search_embeddable.ts | 3 +- .../public/lib/containers/container.ts | 9 +- .../public/context/context.test.tsx | 4 +- .../ops_stats/ops_stats_collector.ts | 2 + .../maps_legacy/public/map/grid_dimensions.js | 24 ++--- src/plugins/share/public/types.ts | 2 +- .../public/components/agg_select.tsx | 6 +- .../components/controls/date_ranges.tsx | 3 +- .../public/components/controls/filter.tsx | 9 +- .../public/components/controls/filters.tsx | 5 +- .../public/components/controls/precision.tsx | 3 +- .../components/sidebar/sidebar_title.tsx | 3 +- .../vis_type_vega/public/data_model/types.ts | 6 +- .../public/data_model/vega_parser.ts | 4 +- .../helpers/point_series/point_series.ts | 1 + .../public/vis_types/react_vis_type.test.ts | 1 + .../components/visualize_editor.tsx | 2 +- .../utils/use/use_saved_vis_instance.test.ts | 1 + .../plugins/kbn_tp_run_pipeline/package.json | 2 +- .../plugins/app_link_test/package.json | 2 +- .../plugins/core_app_status/package.json | 2 +- .../plugins/core_plugin_a/package.json | 2 +- .../plugins/core_plugin_appleave/package.json | 2 +- .../plugins/core_plugin_b/package.json | 2 +- .../core_plugin_chromeless/package.json | 2 +- .../core_plugin_route_timeouts/package.json | 2 +- .../core_plugin_static_assets/package.json | 2 +- .../plugins/core_provider_plugin/package.json | 2 +- .../plugins/doc_views_plugin/package.json | 2 +- .../elasticsearch_client_plugin/package.json | 2 +- .../plugins/index_patterns/package.json | 4 +- .../kbn_sample_panel_action/package.json | 2 +- .../plugins/kbn_top_nav/package.json | 2 +- .../kbn_tp_custom_visualizations/package.json | 2 +- .../management_test_plugin/package.json | 2 +- .../plugins/rendering_plugin/package.json | 2 +- .../plugins/ui_settings_plugin/package.json | 2 +- .../ui_actions_enhanced_examples/package.json | 2 +- x-pack/package.json | 2 +- .../lib/send_email.test.ts | 9 ++ ...configured_action_disabled_modification.ts | 3 +- .../alerts/server/alert_type_registry.test.ts | 23 ++--- x-pack/plugins/apm/e2e/package.json | 2 +- .../app/Main/ProvideBreadcrumbs.test.tsx | 1 + x-pack/plugins/apm/public/plugin.ts | 8 +- .../server/lib/transaction_groups/fetcher.ts | 1 + .../lib/ui_filters/local_ui_filters/index.ts | 7 +- .../beats_management/common/domain_types.ts | 2 +- .../beats_management/server/lib/beats.ts | 2 +- .../lib/aeroelastic/layout_functions.js | 20 ++--- .../public/state/actions/elements.test.js | 6 +- .../state/reducers/resolved_args.test.js | 8 +- .../explore_data_chart_action.test.ts | 1 + .../explore_data/explore_data_chart_action.ts | 3 +- .../explore_data_context_menu_action.test.ts | 1 + .../explore_data_context_menu_action.ts | 3 +- .../edit_policy/edit_policy.test.ts | 1 + .../services/policies/cold_phase.ts | 2 + .../services/policies/warm_phase.ts | 3 + .../template_form/template_form.tsx | 1 + .../inventory/components/alert_flyout.tsx | 11 ++- .../components/alert_flyout.tsx | 13 ++- .../components/alerting/logs/alert_flyout.tsx | 13 ++- .../subscription_splash_content.tsx | 3 +- .../infra/public/hooks/use_trial_status.tsx | 5 +- .../pages/link_to/redirect_to_node_logs.tsx | 3 +- .../public/pages/logs/page_providers.tsx | 3 +- .../ingest_manager/hooks/use_core.ts | 2 +- .../create_package_policy_page/index.tsx | 2 +- .../edit_package_policy_page/index.tsx | 2 +- .../saved_objects/migrations/to_v7_10_0.ts | 2 + .../pipeline_processors_editor/deserialize.ts | 1 + .../create_endpoint_list_item_schema.test.ts | 4 + .../create_exception_list_item_schema.test.ts | 5 ++ .../delete_endpoint_list_item_schema.test.ts | 1 + .../request/delete_list_schema.test.ts | 1 + .../export_list_item_query_schema.test.ts | 1 + .../request/import_list_item_schema.test.ts | 1 + .../request/patch_list_item_schema.test.ts | 1 + .../schemas/request/patch_list_schema.test.ts | 1 + .../read_endpoint_list_item_schema.test.ts | 1 + .../schemas/request/read_list_schema.test.ts | 1 + .../update_endpoint_list_item_schema.test.ts | 4 + .../update_exception_list_item_schema.test.ts | 4 + .../update_exception_list_schema.test.ts | 3 + .../response/acknowledge_schema.test.ts | 1 + .../create_endpoint_list_schema.test.ts | 2 + .../exception_list_item_schema.test.ts | 14 +++ .../response/exception_list_schema.test.ts | 11 +++ .../found_exception_list_item_schema.test.ts | 4 + .../found_exception_list_schema.test.ts | 4 + .../list_item_index_exist_schema.test.ts | 2 + .../schemas/response/list_item_schema.test.ts | 9 ++ .../schemas/response/list_schema.test.ts | 9 ++ .../schemas/types/update_comment.test.ts | 1 + .../lists/public/exceptions/api.test.ts | 11 +++ .../mvt_single_layer_vector_source.tsx | 3 +- .../properties/dynamic_style_property.tsx | 3 +- .../anomaly_detection_jobs/combined_job.ts | 1 + x-pack/plugins/ml/common/types/custom_urls.ts | 2 +- .../application/util/custom_url_utils.ts | 4 +- .../models/calendar/calendar_manager.ts | 7 +- .../models/data_recognizer/data_recognizer.ts | 1 + .../ml/server/models/filter/filter_manager.ts | 5 +- .../validate_model_memory_limit.test.ts | 1 + .../public/application/store/reducer.ts | 2 +- x-pack/plugins/security/common/model/user.ts | 4 +- .../role_mappings/role_mappings_api_client.ts | 10 +-- .../management/roles/roles_api_client.ts | 1 + .../session_management/session_cookie.test.ts | 1 + .../add_prepackged_rules_schema.test.ts | 1 + .../request/create_rules_bulk_schema.test.ts | 5 ++ .../request/import_rules_schema.test.ts | 1 + .../request/update_rules_bulk_schema.test.ts | 5 ++ .../schemas/response/error_schema.test.ts | 1 + .../response/find_rules_schema.test.ts | 2 + .../response/prepackaged_rules_schema.test.ts | 2 + .../prepackaged_rules_status_schema.test.ts | 1 + .../response/rules_bulk_schema.test.ts | 2 + .../schemas/types/lists.test.ts | 2 + .../components/user_action_tree/index.tsx | 2 +- .../user_action_tree/user_action_title.tsx | 2 +- .../public/cases/pages/case_details.tsx | 2 +- .../components/header_section/index.tsx | 10 +-- .../common/components/utility_bar/styles.tsx | 12 ++- .../common/hooks/endpoint/ingest_enabled.ts | 10 +-- .../rules/create/helpers.test.ts | 2 + .../detection_engine/rules/details/index.tsx | 2 +- .../detection_engine/rules/edit/index.tsx | 2 +- .../public/hosts/pages/hosts.tsx | 2 +- .../pages/policy/view/policy_details.tsx | 2 +- .../pages/policy/view/policy_list.tsx | 3 +- .../public/network/pages/network.tsx | 2 +- .../timelines/store/timeline/reducer.test.ts | 1 + .../notifications/read_notifications.test.ts | 1 + .../routes/rules/import_rules_route.test.ts | 2 + .../routes/rules/validate.test.ts | 3 + .../detection_engine/rules/read_rules.test.ts | 1 + .../signals/build_bulk_body.test.ts | 4 + .../detection_engine/tags/read_tags.test.ts | 1 + .../lib/events/elasticsearch_adapter.ts | 5 +- .../server/lib/events/mock.ts | 1 + .../public/app/common/pivot_group_by.ts | 8 +- .../transform_list/expanded_row.tsx | 6 +- .../public/application/app.tsx | 4 +- .../application/context/alerts_context.tsx | 7 +- .../action_factory_definition.ts | 3 +- .../alerts/uptime_alerts_context_provider.tsx | 28 +++++- .../overview/kuery_bar/kuery_bar.tsx | 7 +- .../__tests__/monitor_list_drawer.test.tsx | 1 + .../settings/add_connector_flyout.tsx | 13 ++- .../settings/alert_defaults_form.tsx | 7 +- .../uptime/public/hooks/use_monitor.ts | 2 +- .../__tests__/get_infra_href.test.ts | 3 + .../__tests__/get_logging_href.test.ts | 3 + .../common/fixtures/plugins/aad/package.json | 2 +- .../plugins/actions_simulators/package.json | 2 +- .../fixtures/plugins/alerts/package.json | 2 +- .../plugins/alerts_restricted/package.json | 2 +- .../plugins/task_manager_fixture/package.json | 2 +- .../common/lib/alert_utils.ts | 8 +- .../plugins/iframe_embedded/package.json | 2 +- .../fixtures/plugins/alerts/package.json | 2 +- .../services/alerting/actions.ts | 9 +- .../plugins/elasticsearch_client/package.json | 2 +- .../plugins/event_log/package.json | 2 +- .../plugins/sample_task_plugin/package.json | 2 +- .../task_manager_performance/package.json | 2 +- .../csv_saved_search.ts | 2 +- yarn.lock | 88 +++++++++---------- 195 files changed, 568 insertions(+), 319 deletions(-) diff --git a/examples/embeddable_examples/public/book/book_embeddable.tsx b/examples/embeddable_examples/public/book/book_embeddable.tsx index 33876ab24414e..b033fe86cd1c7 100644 --- a/examples/embeddable_examples/public/book/book_embeddable.tsx +++ b/examples/embeddable_examples/public/book/book_embeddable.tsx @@ -60,7 +60,8 @@ function getHasMatch(search?: string, savedAttributes?: BookSavedObjectAttribute ); } -export class BookEmbeddable extends Embeddable +export class BookEmbeddable + extends Embeddable implements ReferenceOrValueEmbeddable { public readonly type = BOOK_EMBEDDABLE; private subscription: Subscription; diff --git a/package.json b/package.json index 1bf6e8b977af8..b8cf2e1e27774 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "**/@types/chai": "^4.2.11", "**/cypress/@types/lodash": "^4.14.159", "**/cypress/lodash": "^4.17.20", - "**/typescript": "3.9.5", + "**/typescript": "4.0.2", "**/graphql-toolkit/lodash": "^4.17.15", "**/hoist-non-react-statics": "^3.3.2", "**/isomorphic-git/**/base64-js": "^1.2.1", @@ -338,8 +338,8 @@ "@types/vinyl": "^2.0.4", "@types/vinyl-fs": "^2.4.11", "@types/zen-observable": "^0.8.0", - "@typescript-eslint/eslint-plugin": "^3.7.1", - "@typescript-eslint/parser": "^3.7.1", + "@typescript-eslint/eslint-plugin": "^3.10.0", + "@typescript-eslint/parser": "^3.10.0", "angular-aria": "^1.8.0", "angular-mocks": "^1.7.9", "angular-recursion": "^1.0.5", @@ -381,7 +381,7 @@ "eslint-plugin-no-unsanitized": "^3.0.2", "eslint-plugin-node": "^11.0.0", "eslint-plugin-prefer-object-spread": "^1.2.1", - "eslint-plugin-prettier": "^3.1.3", + "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.20.3", "eslint-plugin-react-hooks": "^4.0.4", "eslint-plugin-react-perf": "^3.2.3", @@ -443,7 +443,7 @@ "pkg-up": "^2.0.0", "pngjs": "^3.4.0", "postcss": "^7.0.32", - "prettier": "^2.0.5", + "prettier": "^2.1.1", "prop-types": "15.6.0", "proxyquire": "1.8.0", "react-grid-layout": "^0.16.2", @@ -469,7 +469,7 @@ "tape": "^4.13.0", "topojson-client": "3.0.0", "tree-kill": "^1.2.2", - "typescript": "3.9.5", + "typescript": "4.0.2", "typings-tester": "^0.3.2", "ui-select": "0.19.8", "vega": "^5.13.0", diff --git a/packages/eslint-config-kibana/package.json b/packages/eslint-config-kibana/package.json index 618f71daf0339..4ec3bcdfd7c05 100644 --- a/packages/eslint-config-kibana/package.json +++ b/packages/eslint-config-kibana/package.json @@ -15,8 +15,8 @@ }, "homepage": "https://github.com/elastic/kibana/tree/master/packages/eslint-config-kibana", "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^3.7.1", - "@typescript-eslint/parser": "^3.7.1", + "@typescript-eslint/eslint-plugin": "^3.10.0", + "@typescript-eslint/parser": "^3.10.0", "babel-eslint": "^10.0.3", "eslint": "^6.8.0", "eslint-plugin-babel": "^5.3.0", diff --git a/packages/kbn-analytics/package.json b/packages/kbn-analytics/package.json index 873252ceb0a1a..b04b5b32d0746 100644 --- a/packages/kbn-analytics/package.json +++ b/packages/kbn-analytics/package.json @@ -17,6 +17,6 @@ "@babel/cli": "^7.10.5", "@kbn/dev-utils": "1.0.0", "@kbn/babel-preset": "1.0.0", - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/packages/kbn-config-schema/package.json b/packages/kbn-config-schema/package.json index 10b607dcd4312..10b1741d98441 100644 --- a/packages/kbn-config-schema/package.json +++ b/packages/kbn-config-schema/package.json @@ -10,7 +10,7 @@ "kbn:bootstrap": "yarn build" }, "devDependencies": { - "typescript": "3.9.5", + "typescript": "4.0.2", "tsd": "^0.7.4" }, "peerDependencies": { diff --git a/packages/kbn-dev-utils/package.json b/packages/kbn-dev-utils/package.json index 7ce433f80bed0..768a67794517f 100644 --- a/packages/kbn-dev-utils/package.json +++ b/packages/kbn-dev-utils/package.json @@ -25,7 +25,7 @@ "tslib": "^2.0.0" }, "devDependencies": { - "typescript": "3.9.5", + "typescript": "4.0.2", "@kbn/expect": "1.0.0", "chance": "1.0.18" } diff --git a/packages/kbn-i18n/package.json b/packages/kbn-i18n/package.json index 0f830acb284a0..680c789bc9d9d 100644 --- a/packages/kbn-i18n/package.json +++ b/packages/kbn-i18n/package.json @@ -21,7 +21,7 @@ "del": "^5.1.0", "getopts": "^2.2.4", "supports-color": "^7.0.0", - "typescript": "3.9.5" + "typescript": "4.0.2" }, "dependencies": { "intl-format-cache": "^2.1.0", diff --git a/packages/kbn-monaco/package.json b/packages/kbn-monaco/package.json index 3e5a3cd216225..ca133010fe230 100644 --- a/packages/kbn-monaco/package.json +++ b/packages/kbn-monaco/package.json @@ -20,7 +20,7 @@ "del": "^5.1.0", "raw-loader": "3.1.0", "supports-color": "^7.0.0", - "typescript": "3.9.5", + "typescript": "4.0.2", "webpack": "^4.41.5", "webpack-cli": "^3.3.10" } diff --git a/packages/kbn-plugin-generator/package.json b/packages/kbn-plugin-generator/package.json index 89e4251bd7802..1d9637c8279da 100644 --- a/packages/kbn-plugin-generator/package.json +++ b/packages/kbn-plugin-generator/package.json @@ -14,7 +14,7 @@ "execa": "^4.0.2", "inquirer": "^7.3.3", "normalize-path": "^3.0.0", - "prettier": "^2.0.5", + "prettier": "^2.1.1", "vinyl": "^2.2.0", "vinyl-fs": "^3.0.3" }, diff --git a/packages/kbn-plugin-helpers/package.json b/packages/kbn-plugin-helpers/package.json index 9cc34bcda1af4..ba39528a1f809 100644 --- a/packages/kbn-plugin-helpers/package.json +++ b/packages/kbn-plugin-helpers/package.json @@ -35,7 +35,7 @@ "@types/through2": "^2.0.35", "@types/through2-map": "^3.0.0", "@types/vinyl": "^2.0.4", - "typescript": "3.9.5" + "typescript": "4.0.2" }, "peerDependencies": { "@kbn/babel-preset": "1.0.0" diff --git a/packages/kbn-pm/dist/index.js b/packages/kbn-pm/dist/index.js index 1d4c13e605f27..eb2d0d2581a34 100644 --- a/packages/kbn-pm/dist/index.js +++ b/packages/kbn-pm/dist/index.js @@ -562,6 +562,7 @@ module.exports = require("path"); * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.ToolingLogCollectingWriter = exports.parseLogLevel = exports.pickLevelFromFlags = exports.ToolingLogTextWriter = exports.ToolingLog = void 0; var tooling_log_1 = __webpack_require__(6); Object.defineProperty(exports, "ToolingLog", { enumerable: true, get: function () { return tooling_log_1.ToolingLog; } }); var tooling_log_text_writer_1 = __webpack_require__(110); diff --git a/packages/kbn-pm/package.json b/packages/kbn-pm/package.json index 6b36f14df95e9..914ca2fd65fa2 100644 --- a/packages/kbn-pm/package.json +++ b/packages/kbn-pm/package.json @@ -51,7 +51,7 @@ "multimatch": "^4.0.0", "ncp": "^2.0.0", "ora": "^1.4.0", - "prettier": "^2.0.5", + "prettier": "^2.1.1", "read-pkg": "^5.2.0", "rxjs": "^6.5.5", "spawn-sync": "^1.0.15", @@ -59,7 +59,7 @@ "strip-ansi": "^4.0.0", "strong-log-transformer": "^2.1.0", "tempy": "^0.3.0", - "typescript": "3.9.5", + "typescript": "4.0.2", "unlazy-loader": "^0.1.3", "webpack": "^4.41.5", "webpack-cli": "^3.3.10", diff --git a/packages/kbn-release-notes/package.json b/packages/kbn-release-notes/package.json index 25e1816b6cc1e..12d0122f9a4d3 100644 --- a/packages/kbn-release-notes/package.json +++ b/packages/kbn-release-notes/package.json @@ -18,6 +18,6 @@ }, "devDependencies": { "markdown-it": "^10.0.0", - "typescript": "3.9.5" + "typescript": "4.0.2" } -} \ No newline at end of file +} diff --git a/packages/kbn-spec-to-console/package.json b/packages/kbn-spec-to-console/package.json index 5423bc3fd4ecd..63ce93ac54f46 100644 --- a/packages/kbn-spec-to-console/package.json +++ b/packages/kbn-spec-to-console/package.json @@ -18,7 +18,7 @@ "homepage": "https://github.com/jbudz/spec-to-console#readme", "devDependencies": { "jest": "^25.5.4", - "prettier": "^2.0.5" + "prettier": "^2.1.1" }, "dependencies": { "commander": "^3.0.0", diff --git a/packages/kbn-telemetry-tools/package.json b/packages/kbn-telemetry-tools/package.json index 5593a72ecd965..63a8fcf30335e 100644 --- a/packages/kbn-telemetry-tools/package.json +++ b/packages/kbn-telemetry-tools/package.json @@ -17,6 +17,6 @@ "normalize-path": "^3.0.0", "@types/lodash": "^3.10.1", "moment": "^2.24.0", - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/packages/kbn-telemetry-tools/src/tools/__snapshots__/extract_collectors.test.ts.snap b/packages/kbn-telemetry-tools/src/tools/__snapshots__/extract_collectors.test.ts.snap index bf1d5ffc1101e..68b068b0cfe06 100644 --- a/packages/kbn-telemetry-tools/src/tools/__snapshots__/extract_collectors.test.ts.snap +++ b/packages/kbn-telemetry-tools/src/tools/__snapshots__/extract_collectors.test.ts.snap @@ -9,7 +9,7 @@ Array [ "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 143, + "kind": 146, "type": "StringKeyword", }, }, @@ -31,7 +31,7 @@ Array [ "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 143, + "kind": 146, "type": "StringKeyword", }, }, @@ -53,7 +53,7 @@ Array [ "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 143, + "kind": 146, "type": "StringKeyword", }, }, @@ -75,7 +75,7 @@ Array [ "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 143, + "kind": 146, "type": "StringKeyword", }, }, @@ -99,11 +99,11 @@ Array [ "": Object { "@@INDEX@@": Object { "count_1": Object { - "kind": 140, + "kind": 143, "type": "NumberKeyword", }, "count_2": Object { - "kind": 140, + "kind": 143, "type": "NumberKeyword", }, }, @@ -129,7 +129,7 @@ Array [ "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 143, + "kind": 146, "type": "StringKeyword", }, }, @@ -151,43 +151,43 @@ Array [ "fetch": Object { "typeDescriptor": Object { "flat": Object { - "kind": 143, + "kind": 146, "type": "StringKeyword", }, "my_array": Object { "total": Object { - "kind": 140, + "kind": 143, "type": "NumberKeyword", }, "type": Object { - "kind": 128, + "kind": 131, "type": "BooleanKeyword", }, }, "my_index_signature_prop": Object { "": Object { "@@INDEX@@": Object { - "kind": 140, + "kind": 143, "type": "NumberKeyword", }, }, }, "my_objects": Object { "total": Object { - "kind": 140, + "kind": 143, "type": "NumberKeyword", }, "type": Object { - "kind": 128, + "kind": 131, "type": "BooleanKeyword", }, }, "my_str": Object { - "kind": 143, + "kind": 146, "type": "StringKeyword", }, "my_str_array": Object { - "kind": 143, + "kind": 146, "type": "StringKeyword", }, }, diff --git a/packages/kbn-telemetry-tools/src/tools/serializer.ts b/packages/kbn-telemetry-tools/src/tools/serializer.ts index f945402ec5fc2..d5412f64f3615 100644 --- a/packages/kbn-telemetry-tools/src/tools/serializer.ts +++ b/packages/kbn-telemetry-tools/src/tools/serializer.ts @@ -142,14 +142,11 @@ export function getDescriptor(node: ts.Node, program: ts.Program): Descriptor | } if (ts.isUnionTypeNode(node)) { - const types = node.types.filter((typeNode) => { - return ( - typeNode.kind !== ts.SyntaxKind.NullKeyword && - typeNode.kind !== ts.SyntaxKind.UndefinedKeyword - ); - }); + const types = node.types.filter(discardNullOrUndefined); - const kinds = types.map((typeNode) => getDescriptor(typeNode, program)); + const kinds = types + .map((typeNode) => getDescriptor(typeNode, program)) + .filter(discardNullOrUndefined); const uniqueKinds = uniq(kinds, 'kind'); @@ -172,3 +169,9 @@ export function getDescriptor(node: ts.Node, program: ts.Program): Descriptor | throw new Error(`Unknown type ${ts.SyntaxKind[node.kind]}; ${node.getText()}`); } } + +function discardNullOrUndefined(typeNode: ts.TypeNode | Descriptor | DescriptorValue) { + return ( + typeNode.kind !== ts.SyntaxKind.NullKeyword && typeNode.kind !== ts.SyntaxKind.UndefinedKeyword + ); +} diff --git a/src/fixtures/agg_resp/date_histogram.js b/src/fixtures/agg_resp/date_histogram.js index 5e898697a154c..12bc4e7daf3e5 100644 --- a/src/fixtures/agg_resp/date_histogram.js +++ b/src/fixtures/agg_resp/date_histogram.js @@ -31,7 +31,7 @@ export default { hits: [], }, aggregations: { - '1': { + 1: { buckets: [ { key_as_string: '2015-01-30T01:00:00.000Z', diff --git a/src/fixtures/agg_resp/range.js b/src/fixtures/agg_resp/range.js index 6f02d9b7c7a0a..71729a06f590f 100644 --- a/src/fixtures/agg_resp/range.js +++ b/src/fixtures/agg_resp/range.js @@ -31,7 +31,7 @@ export default { hits: [], }, aggregations: { - '1': { + 1: { buckets: { '*-1024.0': { to: 1024, diff --git a/src/legacy/server/status/lib/metrics.test.js b/src/legacy/server/status/lib/metrics.test.js index 6a734941eb70c..cc9c2607a2b59 100644 --- a/src/legacy/server/status/lib/metrics.test.js +++ b/src/legacy/server/status/lib/metrics.test.js @@ -100,8 +100,8 @@ describe('Metrics', function () { Object.defineProperty(process, 'pid', { get: pidMock }); // const hapiEvent = { - requests: { '5603': { total: 22, disconnects: 0, statusCodes: { '200': 22 } } }, - responseTimes: { '5603': { avg: 1.8636363636363635, max: 4 } }, + requests: { 5603: { total: 22, disconnects: 0, statusCodes: { 200: 22 } } }, + responseTimes: { 5603: { avg: 1.8636363636363635, max: 4 } }, osload: [2.20751953125, 2.02294921875, 1.89794921875], osmem: { total: 17179869184, free: 102318080 }, osup: 1008991, @@ -150,9 +150,9 @@ describe('Metrics', function () { it('parses event with missing fields / NaN for responseTimes.avg', async () => { const hapiEvent = { requests: { - '5603': { total: 22, disconnects: 0, statusCodes: { '200': 22 } }, + 5603: { total: 22, disconnects: 0, statusCodes: { 200: 22 } }, }, - responseTimes: { '5603': { avg: NaN, max: 4 } }, + responseTimes: { 5603: { avg: NaN, max: 4 } }, host: 'blahblah.local', }; diff --git a/src/plugins/advanced_settings/public/management_app/advanced_settings.tsx b/src/plugins/advanced_settings/public/management_app/advanced_settings.tsx index 4afcba14abef4..bbc3f3632bf64 100644 --- a/src/plugins/advanced_settings/public/management_app/advanced_settings.tsx +++ b/src/plugins/advanced_settings/public/management_app/advanced_settings.tsx @@ -243,7 +243,7 @@ export class AdvancedSettingsComponent extends Component< } export const AdvancedSettings = (props: AdvancedSettingsProps) => { - const { query } = useParams(); + const { query } = useParams<{ query: string }>(); return ( { (function () { const endpoints = { - '1': { + 1: { patterns: ['a/b'], methods: ['GET'], }, @@ -125,11 +125,11 @@ describe('Url autocomplete', () => { (function () { const endpoints = { - '1': { + 1: { patterns: ['a/b', 'a/b/{p}'], methods: ['GET'], }, - '2': { + 2: { patterns: ['a/c'], methods: ['GET'], }, @@ -176,14 +176,14 @@ describe('Url autocomplete', () => { (function () { const endpoints = { - '1': { + 1: { patterns: ['a/{p}'], url_components: { p: ['a', 'b'], }, methods: ['GET'], }, - '2': { + 2: { patterns: ['a/c'], methods: ['GET'], }, @@ -230,18 +230,18 @@ describe('Url autocomplete', () => { (function () { const endpoints = { - '1': { + 1: { patterns: ['a/{p}'], url_components: { p: ['a', 'b'], }, methods: ['GET'], }, - '2': { + 2: { patterns: ['b/{p}'], methods: ['GET'], }, - '3': { + 3: { patterns: ['b/{l}/c'], methods: ['GET'], url_components: { @@ -315,7 +315,7 @@ describe('Url autocomplete', () => { (function () { const endpoints = { - '1': { + 1: { patterns: ['a/b/{p}/c/e'], methods: ['GET'], }, diff --git a/src/plugins/dashboard/common/bwc/types.ts b/src/plugins/dashboard/common/bwc/types.ts index 2427799345463..421ea44fa7a24 100644 --- a/src/plugins/dashboard/common/bwc/types.ts +++ b/src/plugins/dashboard/common/bwc/types.ts @@ -53,7 +53,7 @@ interface DashboardAttributes extends SavedObjectAttributes { interface DashboardAttributesTo720 extends SavedObjectAttributes { panelsJSON: string; description: string; - uiStateJSON: string; + uiStateJSON?: string; version: number; timeRestore: boolean; useMargins?: boolean; diff --git a/src/plugins/dashboard/public/application/dashboard_app_controller.tsx b/src/plugins/dashboard/public/application/dashboard_app_controller.tsx index e10265376f2de..0d20fdee07df5 100644 --- a/src/plugins/dashboard/public/application/dashboard_app_controller.tsx +++ b/src/plugins/dashboard/public/application/dashboard_app_controller.tsx @@ -464,6 +464,7 @@ export class DashboardAppController { ); } else if ('input' in incomingEmbeddable) { const input = incomingEmbeddable.input; + // @ts-expect-error delete input.id; const explicitInput = { savedVis: input, diff --git a/src/plugins/data/common/es_query/kuery/ast/ast.test.ts b/src/plugins/data/common/es_query/kuery/ast/ast.test.ts index 6a69d52d72134..7795497dbec8d 100644 --- a/src/plugins/data/common/es_query/kuery/ast/ast.test.ts +++ b/src/plugins/data/common/es_query/kuery/ast/ast.test.ts @@ -350,12 +350,14 @@ describe('kuery AST API', () => { expect(toElasticsearchQuery((null as unknown) as KueryNode, undefined)).toEqual(expected); const noTypeNode = nodeTypes.function.buildNode('exists', 'foo'); + + // @ts-expect-error delete noTypeNode.type; expect(toElasticsearchQuery(noTypeNode)).toEqual(expected); const unknownTypeNode = nodeTypes.function.buildNode('exists', 'foo'); - // @ts-ignore + // @ts-expect-error unknownTypeNode.type = 'notValid'; expect(toElasticsearchQuery(unknownTypeNode)).toEqual(expected); }); diff --git a/src/plugins/discover/public/application/embeddable/search_embeddable.ts b/src/plugins/discover/public/application/embeddable/search_embeddable.ts index b621017677c58..1de62fe5a0348 100644 --- a/src/plugins/discover/public/application/embeddable/search_embeddable.ts +++ b/src/plugins/discover/public/application/embeddable/search_embeddable.ts @@ -78,7 +78,8 @@ interface SearchEmbeddableConfig { filterManager: FilterManager; } -export class SearchEmbeddable extends Embeddable +export class SearchEmbeddable + extends Embeddable implements ISearchEmbeddable { private readonly savedSearch: SavedSearch; private $rootScope: ng.IRootScopeService; diff --git a/src/plugins/embeddable/public/lib/containers/container.ts b/src/plugins/embeddable/public/lib/containers/container.ts index 8cf3d1a15883b..38975cc220bc2 100644 --- a/src/plugins/embeddable/public/lib/containers/container.ts +++ b/src/plugins/embeddable/public/lib/containers/container.ts @@ -35,10 +35,11 @@ import { isSavedObjectEmbeddableInput } from '../embeddables/saved_object_embedd const getKeys = (o: T): Array => Object.keys(o) as Array; export abstract class Container< - TChildInput extends Partial = {}, - TContainerInput extends ContainerInput = ContainerInput, - TContainerOutput extends ContainerOutput = ContainerOutput -> extends Embeddable + TChildInput extends Partial = {}, + TContainerInput extends ContainerInput = ContainerInput, + TContainerOutput extends ContainerOutput = ContainerOutput + > + extends Embeddable implements IContainer { public readonly isContainer: boolean = true; protected readonly children: { diff --git a/src/plugins/kibana_react/public/context/context.test.tsx b/src/plugins/kibana_react/public/context/context.test.tsx index 4008daf69f25d..a873d1cc2ce30 100644 --- a/src/plugins/kibana_react/public/context/context.test.tsx +++ b/src/plugins/kibana_react/public/context/context.test.tsx @@ -122,7 +122,7 @@ test(' provider provides default kibana-react context', ( test(' can set custom services in context', () => { const Test: React.FC = () => { - const { services } = useKibana(); + const { services } = useKibana<{ test: string }>(); expect(services.test).toBe('quux'); return null; }; @@ -137,7 +137,7 @@ test(' can set custom services in context', () => { test('nested override and merge services', () => { const Test: React.FC = () => { - const { services } = useKibana(); + const { services } = useKibana<{ foo: string; bar: string; baz: string }>(); expect(services.foo).toBe('foo2'); expect(services.bar).toBe('bar'); expect(services.baz).toBe('baz3'); diff --git a/src/plugins/kibana_usage_collection/server/collectors/ops_stats/ops_stats_collector.ts b/src/plugins/kibana_usage_collection/server/collectors/ops_stats/ops_stats_collector.ts index df9d6eb146eab..6e8b71d675f7b 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/ops_stats/ops_stats_collector.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/ops_stats/ops_stats_collector.ts @@ -43,11 +43,13 @@ export function getOpsStatsCollector( metrics$.subscribe((_metrics) => { const metrics = cloneDeep(_metrics); // Ensure we only include the same data that Metricbeat collection would get + // @ts-expect-error delete metrics.process.pid; const responseTimes = { average: metrics.response_times.avg_in_millis, max: metrics.response_times.max_in_millis, }; + // @ts-expect-error delete metrics.requests.statusCodes; lastMetrics = { ...metrics, diff --git a/src/plugins/maps_legacy/public/map/grid_dimensions.js b/src/plugins/maps_legacy/public/map/grid_dimensions.js index b3438914d5636..d146adf2ca67f 100644 --- a/src/plugins/maps_legacy/public/map/grid_dimensions.js +++ b/src/plugins/maps_legacy/public/map/grid_dimensions.js @@ -22,18 +22,18 @@ import _ from 'lodash'; // geohash precision mapping of geohash grid cell dimensions (width x height, in meters) at equator. // https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohashgrid-aggregation.html#_cell_dimensions_at_the_equator const gridAtEquator = { - '1': [5009400, 4992600], - '2': [1252300, 624100], - '3': [156500, 156000], - '4': [39100, 19500], - '5': [4900, 4900], - '6': [1200, 609.4], - '7': [152.9, 152.4], - '8': [38.2, 19], - '9': [4.8, 4.8], - '10': [1.2, 0.595], - '11': [0.149, 0.149], - '12': [0.037, 0.019], + 1: [5009400, 4992600], + 2: [1252300, 624100], + 3: [156500, 156000], + 4: [39100, 19500], + 5: [4900, 4900], + 6: [1200, 609.4], + 7: [152.9, 152.4], + 8: [38.2, 19], + 9: [4.8, 4.8], + 10: [1.2, 0.595], + 11: [0.149, 0.149], + 12: [0.037, 0.019], }; export function gridDimensions(precision) { diff --git a/src/plugins/share/public/types.ts b/src/plugins/share/public/types.ts index 8dda9f1195a39..9dcfc3d9e8143 100644 --- a/src/plugins/share/public/types.ts +++ b/src/plugins/share/public/types.ts @@ -55,7 +55,7 @@ export interface ShareContext { * */ export interface ShareContextMenuPanelItem extends Omit { name: string; // EUI will accept a `ReactNode` for the `name` prop, but `ShareContentMenu` assumes a `string`. - sortOrder: number; + sortOrder?: number; } /** diff --git a/src/plugins/vis_default_editor/public/components/agg_select.tsx b/src/plugins/vis_default_editor/public/components/agg_select.tsx index 04b5e48c65e8e..cccfb043cf0af 100644 --- a/src/plugins/vis_default_editor/public/components/agg_select.tsx +++ b/src/plugins/vis_default_editor/public/components/agg_select.tsx @@ -22,8 +22,9 @@ import React, { useEffect, useCallback, useState } from 'react'; import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow, EuiLink, EuiText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; - import { IAggType, IndexPattern } from 'src/plugins/data/public'; + +import { DocLinksStart } from '../../../../core/public'; import { useKibana } from '../../../kibana_react/public'; import { ComboBoxGroupedOptions } from '../utils'; import { AGG_TYPE_ACTION_KEYS, AggTypeAction } from './agg_params_state'; @@ -52,7 +53,7 @@ function DefaultEditorAggSelect({ onChangeAggType, }: DefaultEditorAggSelectProps) { const [isDirty, setIsDirty] = useState(false); - const { services } = useKibana(); + const { services } = useKibana<{ docLinks: DocLinksStart }>(); const selectedOptions: ComboBoxGroupedOptions = value ? [{ label: value.title, target: value }] : []; @@ -71,6 +72,7 @@ function DefaultEditorAggSelect({ let aggHelpLink: string | undefined; if (has(value, 'name')) { + // @ts-expect-error aggHelpLink = services.docLinks.links.aggs[value.name]; } diff --git a/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx b/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx index d3cf87c9ef14a..4afc85ba3b5c2 100644 --- a/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx @@ -37,6 +37,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { isEqual, omit } from 'lodash'; import { useMount } from 'react-use'; +import { DocLinksStart } from 'src/core/public'; import { useKibana } from '../../../../kibana_react/public'; import { AggParamEditorProps } from '../agg_param_props'; @@ -67,7 +68,7 @@ function DateRangesParamEditor({ setValue, setValidity, }: AggParamEditorProps) { - const { services } = useKibana(); + const { services } = useKibana<{ docLinks: DocLinksStart }>(); const [ranges, setRanges] = useState(() => value.map((range) => ({ ...range, id: generateId() })) ); diff --git a/src/plugins/vis_default_editor/public/components/controls/filter.tsx b/src/plugins/vis_default_editor/public/components/controls/filter.tsx index 94fd2d9bc9151..101ca3e8ad457 100644 --- a/src/plugins/vis_default_editor/public/components/controls/filter.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/filter.tsx @@ -21,7 +21,12 @@ import React, { useState } from 'react'; import { EuiForm, EuiButtonIcon, EuiFieldText, EuiFormRow, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { IAggConfig, Query, QueryStringInput } from '../../../../data/public'; +import { + IAggConfig, + Query, + QueryStringInput, + DataPublicPluginStart, +} from '../../../../data/public'; import { useKibana } from '../../../../kibana_react/public'; interface FilterRowProps { @@ -49,7 +54,7 @@ function FilterRow({ onChangeValue, onRemoveFilter, }: FilterRowProps) { - const { services } = useKibana(); + const { services } = useKibana<{ data: DataPublicPluginStart; appName: string }>(); const [showCustomLabel, setShowCustomLabel] = useState(false); const filterLabel = i18n.translate('visDefaultEditor.controls.filters.filterLabel', { defaultMessage: 'Filter {index}', diff --git a/src/plugins/vis_default_editor/public/components/controls/filters.tsx b/src/plugins/vis_default_editor/public/components/controls/filters.tsx index fc676e25ff6d7..b2e6373edfc10 100644 --- a/src/plugins/vis_default_editor/public/components/controls/filters.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/filters.tsx @@ -23,7 +23,8 @@ import { htmlIdGenerator, EuiButton, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { useMount } from 'react-use'; -import { Query } from '../../../../data/public'; +import { Query, DataPublicPluginStart } from '../../../../data/public'; +import { IUiSettingsClient } from '../../../../../core/public'; import { useKibana } from '../../../../kibana_react/public'; import { FilterRow } from './filter'; import { AggParamEditorProps } from '../agg_param_props'; @@ -64,7 +65,7 @@ function FiltersParamEditor({ agg, value = [], setValue }: AggParamEditorProps(); const onAddFilter = () => updateFilters([ diff --git a/src/plugins/vis_default_editor/public/components/controls/precision.tsx b/src/plugins/vis_default_editor/public/components/controls/precision.tsx index ad2011513b171..1826c0ac4b9e6 100644 --- a/src/plugins/vis_default_editor/public/components/controls/precision.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/precision.tsx @@ -21,12 +21,13 @@ import React from 'react'; import { EuiRange, EuiFormRow } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { IUiSettingsClient } from '../../../../../core/public'; import { useKibana } from '../../../../kibana_react/public'; import { AggParamEditorProps } from '../agg_param_props'; function PrecisionParamEditor({ agg, value, setValue }: AggParamEditorProps) { - const { services } = useKibana(); + const { services } = useKibana<{ uiSettings: IUiSettingsClient }>(); const label = i18n.translate('visDefaultEditor.controls.precisionLabel', { defaultMessage: 'Precision', }); diff --git a/src/plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx b/src/plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx index 11ceb5885dd31..4889e6ca049ca 100644 --- a/src/plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx +++ b/src/plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx @@ -37,6 +37,7 @@ import { i18n } from '@kbn/i18n'; import { Vis } from 'src/plugins/visualizations/public'; import { SavedObject } from 'src/plugins/saved_objects/public'; +import { ApplicationStart } from '../../../../../core/public'; import { useKibana } from '../../../../kibana_react/public'; interface LinkedSearchProps { @@ -55,7 +56,7 @@ export function LinkedSearch({ savedSearch, eventEmitter }: LinkedSearchProps) { const [showPopover, setShowPopover] = useState(false); const { services: { application }, - } = useKibana(); + } = useKibana<{ application: ApplicationStart }>(); const closePopover = useCallback(() => setShowPopover(false), []); const onClickButtonLink = useCallback(() => setShowPopover((v) => !v), []); diff --git a/src/plugins/vis_type_vega/public/data_model/types.ts b/src/plugins/vis_type_vega/public/data_model/types.ts index b830b24c92082..14848bf5e8739 100644 --- a/src/plugins/vis_type_vega/public/data_model/types.ts +++ b/src/plugins/vis_type_vega/public/data_model/types.ts @@ -63,7 +63,7 @@ interface Mark { type Renderer = 'svg' | 'canvas'; interface VegaSpecConfig extends KibanaConfig { - kibana: KibanaConfig; + kibana?: KibanaConfig; padding: Padding; projection: Projection; autosize: AutoSize; @@ -103,8 +103,8 @@ export interface VegaSpec { encoding?: Encoding; mark?: string; title?: string; - autosize: AutoSize; - projections: Projection[]; + autosize?: AutoSize; + projections?: Projection[]; width?: number; height?: number; padding?: number | Padding; diff --git a/src/plugins/vis_type_vega/public/data_model/vega_parser.ts b/src/plugins/vis_type_vega/public/data_model/vega_parser.ts index da5c76fa6beab..b3fb2d54cb266 100644 --- a/src/plugins/vis_type_vega/public/data_model/vega_parser.ts +++ b/src/plugins/vis_type_vega/public/data_model/vega_parser.ts @@ -243,13 +243,13 @@ The URL is an identifier only. Kibana and your browser will never access this UR // and will be automatically updated on resize events. // We delete width & height if the autosize is set to "fit" // We also set useResize=true in case autosize=none, and width & height are not set - const autosize = this.spec.autosize.type || this.spec.autosize; + const autosize = this.spec.autosize?.type || this.spec.autosize; if (autosize === 'fit' || (autosize === 'none' && !this.spec.width && !this.spec.height)) { this.useResize = true; } } - if (this.useResize && this.spec.padding && this.spec.autosize.contains !== 'padding') { + if (this.useResize && this.spec.padding && this.spec.autosize?.contains !== 'padding') { if (typeof this.spec.padding === 'object') { this.paddingWidth += (+this.spec.padding.left || 0) + (+this.spec.padding.right || 0); this.paddingHeight += (+this.spec.padding.top || 0) + (+this.spec.padding.bottom || 0); diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts index a1681e0d71bd3..4ba3101d34898 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts +++ b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts @@ -113,6 +113,7 @@ export const buildPointSeriesData = (table: Table, dimensions: Dimensions) => { chart.series = getSeries(table, chart); + // @ts-expect-error delete chart.aspects; return chart; }; diff --git a/src/plugins/visualizations/public/vis_types/react_vis_type.test.ts b/src/plugins/visualizations/public/vis_types/react_vis_type.test.ts index 134106bb3d42a..ecdac06c915fd 100644 --- a/src/plugins/visualizations/public/vis_types/react_vis_type.test.ts +++ b/src/plugins/visualizations/public/vis_types/react_vis_type.test.ts @@ -33,6 +33,7 @@ describe('React Vis Type', () => { it('should throw if component is not set', () => { expect(() => { const missingConfig = cloneDeep(visConfig); + // @ts-expect-error TS knows it's a required property delete missingConfig.visConfig.component; new ReactVisType(missingConfig); }).toThrow(); diff --git a/src/plugins/visualize/public/application/components/visualize_editor.tsx b/src/plugins/visualize/public/application/components/visualize_editor.tsx index 0bf5b26e1339f..6a0bd26a16faa 100644 --- a/src/plugins/visualize/public/application/components/visualize_editor.tsx +++ b/src/plugins/visualize/public/application/components/visualize_editor.tsx @@ -34,7 +34,7 @@ import { VisualizeServices } from '../types'; import { VisualizeEditorCommon } from './visualize_editor_common'; export const VisualizeEditor = () => { - const { id: visualizationIdFromUrl } = useParams(); + const { id: visualizationIdFromUrl } = useParams<{ id: string }>(); const [originatingApp, setOriginatingApp] = useState(); const { services } = useKibana(); const [eventEmitter] = useState(new EventEmitter()); diff --git a/src/plugins/visualize/public/application/utils/use/use_saved_vis_instance.test.ts b/src/plugins/visualize/public/application/utils/use/use_saved_vis_instance.test.ts index a6b6d8ca0e837..ce0f5fe965d7d 100644 --- a/src/plugins/visualize/public/application/utils/use/use_saved_vis_instance.test.ts +++ b/src/plugins/visualize/public/application/utils/use/use_saved_vis_instance.test.ts @@ -149,6 +149,7 @@ describe('useSavedVisInstance', () => { pathname: VisualizeConstants.CREATE_PATH, search: '?type=area&indexPattern=1a2b3c4d', }; + // @ts-ignore-error delete mockSavedVisInstance.savedVis.id; }); diff --git a/test/interpreter_functional/plugins/kbn_tp_run_pipeline/package.json b/test/interpreter_functional/plugins/kbn_tp_run_pipeline/package.json index e1ee1153a28ac..f2e4039f8c2bd 100644 --- a/test/interpreter_functional/plugins/kbn_tp_run_pipeline/package.json +++ b/test/interpreter_functional/plugins/kbn_tp_run_pipeline/package.json @@ -16,6 +16,6 @@ "@kbn/plugin-helpers": "9.0.2", "react": "^16.12.0", "react-dom": "^16.12.0", - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/app_link_test/package.json b/test/plugin_functional/plugins/app_link_test/package.json index 9ee3527a237d3..39b56d89a8f0b 100644 --- a/test/plugin_functional/plugins/app_link_test/package.json +++ b/test/plugin_functional/plugins/app_link_test/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/core_app_status/package.json b/test/plugin_functional/plugins/core_app_status/package.json index 1f3e4c0b577f2..2bcd741d5a563 100644 --- a/test/plugin_functional/plugins/core_app_status/package.json +++ b/test/plugin_functional/plugins/core_app_status/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/core_plugin_a/package.json b/test/plugin_functional/plugins/core_plugin_a/package.json index fea4d4cd9ac65..4cdecda569dbf 100644 --- a/test/plugin_functional/plugins/core_plugin_a/package.json +++ b/test/plugin_functional/plugins/core_plugin_a/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/core_plugin_appleave/package.json b/test/plugin_functional/plugins/core_plugin_appleave/package.json index c80b5659d0167..8a63854c83e87 100644 --- a/test/plugin_functional/plugins/core_plugin_appleave/package.json +++ b/test/plugin_functional/plugins/core_plugin_appleave/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/core_plugin_b/package.json b/test/plugin_functional/plugins/core_plugin_b/package.json index 370776a2e42bb..2b4501cb306a9 100644 --- a/test/plugin_functional/plugins/core_plugin_b/package.json +++ b/test/plugin_functional/plugins/core_plugin_b/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/core_plugin_chromeless/package.json b/test/plugin_functional/plugins/core_plugin_chromeless/package.json index e78f9249fb875..976ca197a6d51 100644 --- a/test/plugin_functional/plugins/core_plugin_chromeless/package.json +++ b/test/plugin_functional/plugins/core_plugin_chromeless/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/core_plugin_route_timeouts/package.json b/test/plugin_functional/plugins/core_plugin_route_timeouts/package.json index a9c520338457b..a198e6ed70018 100644 --- a/test/plugin_functional/plugins/core_plugin_route_timeouts/package.json +++ b/test/plugin_functional/plugins/core_plugin_route_timeouts/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/core_plugin_static_assets/package.json b/test/plugin_functional/plugins/core_plugin_static_assets/package.json index 3de8f7845b1a7..0e944276605ff 100644 --- a/test/plugin_functional/plugins/core_plugin_static_assets/package.json +++ b/test/plugin_functional/plugins/core_plugin_static_assets/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/core_provider_plugin/package.json b/test/plugin_functional/plugins/core_provider_plugin/package.json index 061b897cd9eea..ce76df7fdf992 100644 --- a/test/plugin_functional/plugins/core_provider_plugin/package.json +++ b/test/plugin_functional/plugins/core_provider_plugin/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/doc_views_plugin/package.json b/test/plugin_functional/plugins/doc_views_plugin/package.json index 6189ed2e024ab..e6999fc6fe46c 100644 --- a/test/plugin_functional/plugins/doc_views_plugin/package.json +++ b/test/plugin_functional/plugins/doc_views_plugin/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/elasticsearch_client_plugin/package.json b/test/plugin_functional/plugins/elasticsearch_client_plugin/package.json index 02c2955f26c86..575363e83f029 100644 --- a/test/plugin_functional/plugins/elasticsearch_client_plugin/package.json +++ b/test/plugin_functional/plugins/elasticsearch_client_plugin/package.json @@ -10,6 +10,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/index_patterns/package.json b/test/plugin_functional/plugins/index_patterns/package.json index eaba6ca624bd8..831f54cf9de8e 100644 --- a/test/plugin_functional/plugins/index_patterns/package.json +++ b/test/plugin_functional/plugins/index_patterns/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } -} \ No newline at end of file +} diff --git a/test/plugin_functional/plugins/kbn_sample_panel_action/package.json b/test/plugin_functional/plugins/kbn_sample_panel_action/package.json index b3cef400089b0..0e1a0b550ca15 100644 --- a/test/plugin_functional/plugins/kbn_sample_panel_action/package.json +++ b/test/plugin_functional/plugins/kbn_sample_panel_action/package.json @@ -14,6 +14,6 @@ "devDependencies": { "@elastic/eui": "27.4.1", "react": "^16.12.0", - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/kbn_top_nav/package.json b/test/plugin_functional/plugins/kbn_top_nav/package.json index 101593e7258e8..65986d7288381 100644 --- a/test/plugin_functional/plugins/kbn_top_nav/package.json +++ b/test/plugin_functional/plugins/kbn_top_nav/package.json @@ -12,7 +12,7 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/kbn_tp_custom_visualizations/package.json b/test/plugin_functional/plugins/kbn_tp_custom_visualizations/package.json index 9250a4499662f..fd1fb0aa1fca9 100644 --- a/test/plugin_functional/plugins/kbn_tp_custom_visualizations/package.json +++ b/test/plugin_functional/plugins/kbn_tp_custom_visualizations/package.json @@ -15,6 +15,6 @@ "@elastic/eui": "27.4.1", "@kbn/plugin-helpers": "9.0.2", "react": "^16.12.0", - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/management_test_plugin/package.json b/test/plugin_functional/plugins/management_test_plugin/package.json index d4919970f06e7..2854e8e332203 100644 --- a/test/plugin_functional/plugins/management_test_plugin/package.json +++ b/test/plugin_functional/plugins/management_test_plugin/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/rendering_plugin/package.json b/test/plugin_functional/plugins/rendering_plugin/package.json index 5554669758aff..a53b47c9a1ecc 100644 --- a/test/plugin_functional/plugins/rendering_plugin/package.json +++ b/test/plugin_functional/plugins/rendering_plugin/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/test/plugin_functional/plugins/ui_settings_plugin/package.json b/test/plugin_functional/plugins/ui_settings_plugin/package.json index 1c5abcf2a65c2..ec3185f8f49f6 100644 --- a/test/plugin_functional/plugins/ui_settings_plugin/package.json +++ b/test/plugin_functional/plugins/ui_settings_plugin/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/x-pack/examples/ui_actions_enhanced_examples/package.json b/x-pack/examples/ui_actions_enhanced_examples/package.json index 4c8b2a716d98f..057a0706b59b6 100644 --- a/x-pack/examples/ui_actions_enhanced_examples/package.json +++ b/x-pack/examples/ui_actions_enhanced_examples/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/x-pack/package.json b/x-pack/package.json index 247130f4895bb..dd8cb589dc232 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -259,7 +259,7 @@ "topojson-client": "3.0.0", "tree-kill": "^1.2.2", "ts-loader": "^6.0.4", - "typescript": "3.9.5", + "typescript": "4.0.2", "typescript-fsa": "^3.0.0", "typescript-fsa-reducers": "^1.2.1", "unstated": "^2.1.1", diff --git a/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.test.ts b/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.test.ts index 8287ee944bca9..f69a2fc1d209c 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.test.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.test.ts @@ -76,8 +76,11 @@ describe('send_email module', () => { rejectUnauthorizedCertificates: false, } ); + // @ts-expect-error delete sendEmailOptions.transport.service; + // @ts-expect-error delete sendEmailOptions.transport.user; + // @ts-expect-error delete sendEmailOptions.transport.password; const result = await sendEmail(mockLogger, sendEmailOptions); expect(result).toBe(sendMailMockResult); @@ -123,8 +126,11 @@ describe('send_email module', () => { port: 1025, }, }); + // @ts-expect-error delete sendEmailOptions.transport.service; + // @ts-expect-error delete sendEmailOptions.transport.user; + // @ts-expect-error delete sendEmailOptions.transport.password; const result = await sendEmail(mockLogger, sendEmailOptions); expect(result).toBe(sendMailMockResult); @@ -166,8 +172,11 @@ describe('send_email module', () => { secure: true, }, }); + // @ts-expect-error delete sendEmailOptions.transport.service; + // @ts-expect-error delete sendEmailOptions.transport.user; + // @ts-expect-error delete sendEmailOptions.transport.password; const result = await sendEmail(mockLogger, sendEmailOptions); diff --git a/x-pack/plugins/actions/server/lib/errors/preconfigured_action_disabled_modification.ts b/x-pack/plugins/actions/server/lib/errors/preconfigured_action_disabled_modification.ts index 884353e132b9c..20790d7cf5128 100644 --- a/x-pack/plugins/actions/server/lib/errors/preconfigured_action_disabled_modification.ts +++ b/x-pack/plugins/actions/server/lib/errors/preconfigured_action_disabled_modification.ts @@ -9,7 +9,8 @@ import { ErrorThatHandlesItsOwnResponse } from './types'; export type PreconfiguredActionDisabledFrom = 'update' | 'delete'; -export class PreconfiguredActionDisabledModificationError extends Error +export class PreconfiguredActionDisabledModificationError + extends Error implements ErrorThatHandlesItsOwnResponse { public readonly disabledFrom: PreconfiguredActionDisabledFrom; diff --git a/x-pack/plugins/alerts/server/alert_type_registry.test.ts b/x-pack/plugins/alerts/server/alert_type_registry.test.ts index 60adde80e883f..048cc3d5a4440 100644 --- a/x-pack/plugins/alerts/server/alert_type_registry.test.ts +++ b/x-pack/plugins/alerts/server/alert_type_registry.test.ts @@ -316,22 +316,13 @@ function alertTypeWithVariables(id: string, context: string, state: string): Ale producer: 'alerts', }; - if (!context && !state) { - return baseAlert; - } + if (!context && !state) return baseAlert; - const actionVariables = { - context: [{ name: context, description: `${id} context` }], - state: [{ name: state, description: `${id} state` }], + return { + ...baseAlert, + actionVariables: { + ...(context ? { context: [{ name: context, description: `${id} context` }] } : {}), + ...(state ? { state: [{ name: state, description: `${id} state` }] } : {}), + }, }; - - if (!context) { - delete actionVariables.context; - } - - if (!state) { - delete actionVariables.state; - } - - return { ...baseAlert, actionVariables }; } diff --git a/x-pack/plugins/apm/e2e/package.json b/x-pack/plugins/apm/e2e/package.json index d113b465fdf2f..56204b5fb9f9d 100644 --- a/x-pack/plugins/apm/e2e/package.json +++ b/x-pack/plugins/apm/e2e/package.json @@ -17,7 +17,7 @@ "p-limit": "^3.0.1", "p-retry": "^4.2.0", "ts-loader": "^7.0.5", - "typescript": "3.9.6", + "typescript": "4.0.2", "wait-on": "^5.0.1", "webpack": "^4.43.0", "yargs": "^15.4.0" diff --git a/x-pack/plugins/apm/public/components/app/Main/ProvideBreadcrumbs.test.tsx b/x-pack/plugins/apm/public/components/app/Main/ProvideBreadcrumbs.test.tsx index c6e2c0eff8166..bf1cd75432ff5 100644 --- a/x-pack/plugins/apm/public/components/app/Main/ProvideBreadcrumbs.test.tsx +++ b/x-pack/plugins/apm/public/components/app/Main/ProvideBreadcrumbs.test.tsx @@ -74,6 +74,7 @@ Array [ const location = getLocation(); const routes = getTestRoutes(); + // @ts-expect-error delete routes[2].breadcrumb; const breadcrumbs = getBreadcrumbs({ location, routes }); diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts index 27662585d01fa..0d25ececd5156 100644 --- a/x-pack/plugins/apm/public/plugin.ts +++ b/x-pack/plugins/apm/public/plugin.ts @@ -145,8 +145,8 @@ export class ApmPlugin implements Plugin { defaultMessage: 'Error rate', }), iconClass: 'bell', - alertParamsExpression: lazy(() => - import('./components/shared/ErrorRateAlertTrigger') + alertParamsExpression: lazy( + () => import('./components/shared/ErrorRateAlertTrigger') ), validate: () => ({ errors: [], @@ -160,8 +160,8 @@ export class ApmPlugin implements Plugin { defaultMessage: 'Transaction duration', }), iconClass: 'bell', - alertParamsExpression: lazy(() => - import('./components/shared/TransactionDurationAlertTrigger') + alertParamsExpression: lazy( + () => import('./components/shared/TransactionDurationAlertTrigger') ), validate: () => ({ errors: [], diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts index b06d1a8af3bc5..2a1a581c79574 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts @@ -110,6 +110,7 @@ export async function transactionGroupsFetcher( const isTopTraces = options.type === 'top_traces'; + // @ts-expect-error delete projection.body.aggs; // traces overview is hardcoded to 10000 diff --git a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts index 12c02679d0859..78c4abd75f2ee 100644 --- a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts +++ b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts @@ -52,10 +52,9 @@ export async function getLocalUIFilters({ buckets.map((bucket) => { return { name: bucket.key as string, - count: - 'bucket_count' in bucket - ? bucket.bucket_count.value - : bucket.doc_count, + count: bucket.bucket_count + ? bucket.bucket_count.value + : bucket.doc_count, }; }), 'count', diff --git a/x-pack/plugins/beats_management/common/domain_types.ts b/x-pack/plugins/beats_management/common/domain_types.ts index 32e1d81451c65..77c1c05667d47 100644 --- a/x-pack/plugins/beats_management/common/domain_types.ts +++ b/x-pack/plugins/beats_management/common/domain_types.ts @@ -41,7 +41,7 @@ export interface CMBeat { status?: BeatEvent; enrollment_token: string; active: boolean; - access_token: string; + access_token?: string; verified_on?: string; type: string; version?: string; diff --git a/x-pack/plugins/beats_management/server/lib/beats.ts b/x-pack/plugins/beats_management/server/lib/beats.ts index e8a6e6f999ca3..c539e9480af2b 100644 --- a/x-pack/plugins/beats_management/server/lib/beats.ts +++ b/x-pack/plugins/beats_management/server/lib/beats.ts @@ -72,7 +72,7 @@ export class CMBeatsDomain { if (typeof userOrToken === 'string') { const { verified: isAccessTokenValid } = this.tokens.verifyToken( - beat ? beat.access_token : '', + beat?.access_token ?? '', userOrToken ); if (!isAccessTokenValid) { diff --git a/x-pack/plugins/canvas/public/lib/aeroelastic/layout_functions.js b/x-pack/plugins/canvas/public/lib/aeroelastic/layout_functions.js index c2c6f77fb167c..0bc6c099106a6 100644 --- a/x-pack/plugins/canvas/public/lib/aeroelastic/layout_functions.js +++ b/x-pack/plugins/canvas/public/lib/aeroelastic/layout_functions.js @@ -106,18 +106,18 @@ const cornerVertices = [ const resizeMultiplierHorizontal = { left: -1, center: 0, right: 1 }; const resizeMultiplierVertical = { top: -1, center: 0, bottom: 1 }; -const xNames = { '-1': 'left', '0': 'center', '1': 'right' }; -const yNames = { '-1': 'top', '0': 'center', '1': 'bottom' }; +const xNames = { '-1': 'left', 0: 'center', 1: 'right' }; +const yNames = { '-1': 'top', 0: 'center', 1: 'bottom' }; const bidirectionalCursors = { - '0': 'ns-resize', - '45': 'nesw-resize', - '90': 'ew-resize', - '135': 'nwse-resize', - '180': 'ns-resize', - '225': 'nesw-resize', - '270': 'ew-resize', - '315': 'nwse-resize', + 0: 'ns-resize', + 45: 'nesw-resize', + 90: 'ew-resize', + 135: 'nwse-resize', + 180: 'ns-resize', + 225: 'nesw-resize', + 270: 'ew-resize', + 315: 'nwse-resize', }; const identityAABB = () => [ diff --git a/x-pack/plugins/canvas/public/state/actions/elements.test.js b/x-pack/plugins/canvas/public/state/actions/elements.test.js index a790e81e65e25..fc27e422682e1 100644 --- a/x-pack/plugins/canvas/public/state/actions/elements.test.js +++ b/x-pack/plugins/canvas/public/state/actions/elements.test.js @@ -12,7 +12,7 @@ describe('getSiblingContext', () => { resolvedArgs: { 'element-foo': { expressionContext: { - '0': { + 0: { state: 'ready', value: { type: 'datatable', @@ -28,7 +28,7 @@ describe('getSiblingContext', () => { }, error: null, }, - '1': { + 1: { state: 'ready', value: { type: 'datatable', @@ -44,7 +44,7 @@ describe('getSiblingContext', () => { }, error: null, }, - '2': { + 2: { state: 'ready', value: { type: 'pointseries', diff --git a/x-pack/plugins/canvas/public/state/reducers/resolved_args.test.js b/x-pack/plugins/canvas/public/state/reducers/resolved_args.test.js index 74f1544403e67..987e468031713 100644 --- a/x-pack/plugins/canvas/public/state/reducers/resolved_args.test.js +++ b/x-pack/plugins/canvas/public/state/reducers/resolved_args.test.js @@ -162,22 +162,22 @@ describe('resolved args reducer', () => { resolvedArgs: { 'element-1': { expressionContext: { - '1': { + 1: { state: 'ready', value: 'test-1', error: null, }, - '2': { + 2: { state: 'ready', value: 'test-2', error: null, }, - '3': { + 3: { state: 'ready', value: 'test-3', error: null, }, - '4': { + 4: { state: 'ready', value: 'test-4', error: null, diff --git a/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_chart_action.test.ts b/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_chart_action.test.ts index b6bdafc26b445..e57c2af5b83cf 100644 --- a/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_chart_action.test.ts +++ b/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_chart_action.test.ts @@ -156,6 +156,7 @@ describe('"Explore underlying data" panel action', () => { test('returns false if embeddable does not have index patterns', async () => { const { action, output, context } = setup(); + // @ts-expect-error delete output.indexPatterns; const isCompatible = await action.isCompatible(context); diff --git a/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_chart_action.ts b/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_chart_action.ts index 44ad3c57f7e24..0a7be858691af 100644 --- a/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_chart_action.ts +++ b/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_chart_action.ts @@ -25,7 +25,8 @@ export const ACTION_EXPLORE_DATA_CHART = 'ACTION_EXPLORE_DATA_CHART'; * This is "Explore underlying data" action which appears in popup context * menu when user clicks a value in visualization or brushes a time range. */ -export class ExploreDataChartAction extends AbstractExploreDataAction +export class ExploreDataChartAction + extends AbstractExploreDataAction implements Action { public readonly id = ACTION_EXPLORE_DATA_CHART; diff --git a/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.test.ts b/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.test.ts index 6baf6747f4bba..cd76fe29a5dc2 100644 --- a/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.test.ts +++ b/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.test.ts @@ -140,6 +140,7 @@ describe('"Explore underlying data" panel action', () => { test('returns false if embeddable does not have index patterns', async () => { const { action, output, context } = setup(); + // @ts-expect-error delete output.indexPatterns; const isCompatible = await action.isCompatible(context); diff --git a/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.ts b/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.ts index bc74748806beb..6e748030fe107 100644 --- a/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.ts +++ b/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.ts @@ -17,7 +17,8 @@ export const ACTION_EXPLORE_DATA = 'ACTION_EXPLORE_DATA'; * This is "Explore underlying data" action which appears in the context * menu of a dashboard panel. */ -export class ExploreDataContextMenuAction extends AbstractExploreDataAction +export class ExploreDataContextMenuAction + extends AbstractExploreDataAction implements Action { public readonly id = ACTION_EXPLORE_DATA; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts index 36feb3f6203c8..b465afb8b5d9f 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts @@ -101,6 +101,7 @@ describe('', () => { }, }, }; + delete expected.phases.delete.actions.wait_for_snapshot; const latestRequest = server.requests[server.requests.length - 1]; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/services/policies/cold_phase.ts b/x-pack/plugins/index_lifecycle_management/public/application/services/policies/cold_phase.ts index d9ed7a0bf51eb..6cc43042ed4ff 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/services/policies/cold_phase.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/services/policies/cold_phase.ts @@ -90,6 +90,7 @@ export const coldPhaseToES = ( }; } else { if (esPhase.actions.allocate) { + // @ts-expect-error delete esPhase.actions.allocate.require; } } @@ -99,6 +100,7 @@ export const coldPhaseToES = ( esPhase.actions.allocate.number_of_replicas = parseInt(phase.selectedReplicaCount, 10); } else { if (esPhase.actions.allocate) { + // @ts-expect-error delete esPhase.actions.allocate.number_of_replicas; } } diff --git a/x-pack/plugins/index_lifecycle_management/public/application/services/policies/warm_phase.ts b/x-pack/plugins/index_lifecycle_management/public/application/services/policies/warm_phase.ts index 3ca1a1cc83371..c331f4ccce38f 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/services/policies/warm_phase.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/services/policies/warm_phase.ts @@ -96,6 +96,7 @@ export const warmPhaseToES = ( // An index lifecycle switches to warm phase when rollover occurs, so you cannot specify a warm phase time // They are mutually exclusive if (phase.warmPhaseOnRollover) { + // @ts-expect-error delete esPhase.min_age; } @@ -109,6 +110,7 @@ export const warmPhaseToES = ( }; } else { if (esPhase.actions.allocate) { + // @ts-expect-error delete esPhase.actions.allocate.require; } } @@ -118,6 +120,7 @@ export const warmPhaseToES = ( esPhase.actions.allocate.number_of_replicas = parseInt(phase.selectedReplicaCount, 10); } else { if (esPhase.actions.allocate) { + // @ts-expect-error delete esPhase.actions.allocate.number_of_replicas; } } diff --git a/x-pack/plugins/index_management/public/application/components/template_form/template_form.tsx b/x-pack/plugins/index_management/public/application/components/template_form/template_form.tsx index 151b31b527228..537f421173358 100644 --- a/x-pack/plugins/index_management/public/application/components/template_form/template_form.tsx +++ b/x-pack/plugins/index_management/public/application/components/template_form/template_form.tsx @@ -180,6 +180,7 @@ export const TemplateForm = ({ delete outputTemplate.template.aliases; } if (Object.keys(outputTemplate.template).length === 0) { + // @ts-expect-error delete outputTemplate.template; } diff --git a/x-pack/plugins/infra/public/alerting/inventory/components/alert_flyout.tsx b/x-pack/plugins/infra/public/alerting/inventory/components/alert_flyout.tsx index 834afefd74712..f7f7048aedf48 100644 --- a/x-pack/plugins/infra/public/alerting/inventory/components/alert_flyout.tsx +++ b/x-pack/plugins/infra/public/alerting/inventory/components/alert_flyout.tsx @@ -5,6 +5,8 @@ */ import React, { useContext } from 'react'; +import { ApplicationStart, DocLinksStart, HttpStart, NotificationsStart } from 'src/core/public'; + import { AlertsContextProvider, AlertAdd } from '../../../../../triggers_actions_ui/public'; import { TriggerActionsContext } from '../../../utils/triggers_actions_context'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; @@ -22,9 +24,16 @@ interface Props { setVisible: React.Dispatch>; } +interface KibanaDeps { + notifications: NotificationsStart; + http: HttpStart; + docLinks: DocLinksStart; + application: ApplicationStart; +} + export const AlertFlyout = ({ options, nodeType, filter, visible, setVisible }: Props) => { const { triggersActionsUI } = useContext(TriggerActionsContext); - const { services } = useKibana(); + const { services } = useKibana(); const { inventoryPrefill } = useAlertPrefillContext(); const { customMetrics } = inventoryPrefill; diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/alert_flyout.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/alert_flyout.tsx index b19a399b0e50d..1f1af38809a3e 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/alert_flyout.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/alert_flyout.tsx @@ -5,6 +5,8 @@ */ import React, { useContext } from 'react'; +import { ApplicationStart, DocLinksStart, HttpStart, NotificationsStart } from 'src/core/public'; + import { AlertsContextProvider, AlertAdd } from '../../../../../triggers_actions_ui/public'; import { TriggerActionsContext } from '../../../utils/triggers_actions_context'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; @@ -20,9 +22,16 @@ interface Props { setVisible: React.Dispatch>; } +interface KibanaDeps { + notifications: NotificationsStart; + http: HttpStart; + docLinks: DocLinksStart; + application: ApplicationStart; +} + export const AlertFlyout = (props: Props) => { const { triggersActionsUI } = useContext(TriggerActionsContext); - const { services } = useKibana(); + const { services } = useKibana(); return ( <> @@ -33,7 +42,7 @@ export const AlertFlyout = (props: Props) => { currentOptions: props.options, series: props.series, }, - toastNotifications: services.notifications?.toasts, + toastNotifications: services.notifications.toasts, http: services.http, docLinks: services.docLinks, capabilities: services.application.capabilities, diff --git a/x-pack/plugins/infra/public/components/alerting/logs/alert_flyout.tsx b/x-pack/plugins/infra/public/components/alerting/logs/alert_flyout.tsx index bd889bff8cd0e..45e4f8576892c 100644 --- a/x-pack/plugins/infra/public/components/alerting/logs/alert_flyout.tsx +++ b/x-pack/plugins/infra/public/components/alerting/logs/alert_flyout.tsx @@ -5,6 +5,8 @@ */ import React, { useContext } from 'react'; +import { ApplicationStart, DocLinksStart, HttpStart, NotificationsStart } from 'src/core/public'; + import { AlertsContextProvider, AlertAdd } from '../../../../../triggers_actions_ui/public'; import { TriggerActionsContext } from '../../../utils/triggers_actions_context'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; @@ -15,9 +17,16 @@ interface Props { setVisible: React.Dispatch>; } +interface KibanaDeps { + notifications: NotificationsStart; + http: HttpStart; + docLinks: DocLinksStart; + application: ApplicationStart; +} + export const AlertFlyout = (props: Props) => { const { triggersActionsUI } = useContext(TriggerActionsContext); - const { services } = useKibana(); + const { services } = useKibana(); return ( <> @@ -27,7 +36,7 @@ export const AlertFlyout = (props: Props) => { metadata: { isInternal: true, }, - toastNotifications: services.notifications?.toasts, + toastNotifications: services.notifications.toasts, http: services.http, docLinks: services.docLinks, capabilities: services.application.capabilities, diff --git a/x-pack/plugins/infra/public/components/logging/log_analysis_setup/subscription_splash_content.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/subscription_splash_content.tsx index 81f52f986cab8..366d31897fe06 100644 --- a/x-pack/plugins/infra/public/components/logging/log_analysis_setup/subscription_splash_content.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/subscription_splash_content.tsx @@ -20,6 +20,7 @@ import { EuiImage, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; +import { HttpStart } from 'src/core/public'; import { LoadingPage } from '../../loading_page'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; @@ -27,7 +28,7 @@ import { euiStyled } from '../../../../../observability/public'; import { useTrialStatus } from '../../../hooks/use_trial_status'; export const SubscriptionSplashContent: React.FC = () => { - const { services } = useKibana(); + const { services } = useKibana<{ http: HttpStart }>(); const { loadState, isTrialAvailable, checkTrialAvailability } = useTrialStatus(); useEffect(() => { diff --git a/x-pack/plugins/infra/public/hooks/use_trial_status.tsx b/x-pack/plugins/infra/public/hooks/use_trial_status.tsx index 9cc118d09c7e0..3fb7fcfd8edf1 100644 --- a/x-pack/plugins/infra/public/hooks/use_trial_status.tsx +++ b/x-pack/plugins/infra/public/hooks/use_trial_status.tsx @@ -6,8 +6,9 @@ import { boolean } from 'io-ts'; import { i18n } from '@kbn/i18n'; - import { useState } from 'react'; +import { HttpStart, NotificationsStart } from 'src/core/public'; + import { useKibana } from '../../../../../src/plugins/kibana_react/public'; import { API_BASE_PATH as LICENSE_MANAGEMENT_API_BASE_PATH } from '../../../license_management/common/constants'; import { useTrackedPromise } from '../utils/use_tracked_promise'; @@ -20,7 +21,7 @@ interface UseTrialStatusState { } export function useTrialStatus(): UseTrialStatusState { - const { services } = useKibana(); + const { services } = useKibana<{ http: HttpStart; notifications: NotificationsStart }>(); const [isTrialAvailable, setIsTrialAvailable] = useState(false); const [loadState, checkTrialAvailability] = useTrackedPromise( diff --git a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx index d1d4b829fefc1..a32e1e68141b5 100644 --- a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx @@ -9,6 +9,7 @@ import flowRight from 'lodash/flowRight'; import React from 'react'; import { Redirect, RouteComponentProps } from 'react-router-dom'; import { useMount } from 'react-use'; +import { HttpStart } from 'src/core/public'; import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; import { findInventoryFields } from '../../../common/inventory_models'; import { InventoryItemType } from '../../../common/inventory_models/types'; @@ -32,7 +33,7 @@ export const RedirectToNodeLogs = ({ }, location, }: RedirectToNodeLogsType) => { - const { services } = useKibana(); + const { services } = useKibana<{ http: HttpStart }>(); const { isLoading, loadSourceConfiguration, sourceConfiguration } = useLogSource({ fetch: services.http.fetch, sourceId, diff --git a/x-pack/plugins/infra/public/pages/logs/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/page_providers.tsx index 1e053d8d4abc3..a3d0c2bafad40 100644 --- a/x-pack/plugins/infra/public/pages/logs/page_providers.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_providers.tsx @@ -5,6 +5,7 @@ */ import React from 'react'; +import { HttpStart } from 'src/core/public'; import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; import { LogAnalysisCapabilitiesProvider } from '../../containers/logs/log_analysis'; import { LogSourceProvider } from '../../containers/logs/log_source'; @@ -12,7 +13,7 @@ import { useSourceId } from '../../containers/source_id'; export const LogsPageProviders: React.FunctionComponent = ({ children }) => { const [sourceId] = useSourceId(); - const { services } = useKibana(); + const { services } = useKibana<{ http: HttpStart }>(); return ( {children} diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/hooks/use_core.ts b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/hooks/use_core.ts index 9ce1e95aa91d5..dad2eaa1d8e0f 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/hooks/use_core.ts +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/hooks/use_core.ts @@ -8,7 +8,7 @@ import { CoreStart } from 'kibana/public'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; export function useCore(): CoreStart { - const { services } = useKibana(); + const { services } = useKibana(); if (services === null) { throw new Error('KibanaContextProvider not initialized'); } diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/create_package_policy_page/index.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/create_package_policy_page/index.tsx index bdd43b8385ae8..1456d56222b4f 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/create_package_policy_page/index.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/create_package_policy_page/index.tsx @@ -65,7 +65,7 @@ export const CreatePackagePolicyPage: React.FunctionComponent = () => { } = useConfig(); const { params: { policyId, pkgkey }, - } = useRouteMatch(); + } = useRouteMatch<{ policyId: string; pkgkey: string }>(); const { getHref, getPath } = useLink(); const history = useHistory(); const routeState = useIntraAppState(); diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/edit_package_policy_page/index.tsx index fc3d28c9392ce..db76c3db9a983 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/edit_package_policy_page/index.tsx @@ -53,7 +53,7 @@ export const EditPackagePolicyPage: React.FunctionComponent = () => { } = useConfig(); const { params: { policyId, packagePolicyId }, - } = useRouteMatch(); + } = useRouteMatch<{ policyId: string; packagePolicyId: string }>(); const history = useHistory(); const { getHref, getPath } = useLink(); const [isNavDrawerLocked, setIsNavDrawerLocked] = useState(false); diff --git a/x-pack/plugins/ingest_manager/server/saved_objects/migrations/to_v7_10_0.ts b/x-pack/plugins/ingest_manager/server/saved_objects/migrations/to_v7_10_0.ts index f45b69eaaa79c..b60903dbd2bd0 100644 --- a/x-pack/plugins/ingest_manager/server/saved_objects/migrations/to_v7_10_0.ts +++ b/x-pack/plugins/ingest_manager/server/saved_objects/migrations/to_v7_10_0.ts @@ -42,6 +42,7 @@ export const migrateAgentPolicyToV7100: SavedObjectMigrationFn< AgentPolicy > = (agentPolicyDoc) => { agentPolicyDoc.attributes.package_policies = agentPolicyDoc.attributes.package_configs; + // @ts-expect-error delete agentPolicyDoc.attributes.package_configs; return agentPolicyDoc; @@ -66,6 +67,7 @@ export const migratePackagePolicyToV7100: SavedObjectMigrationFn< PackagePolicy > = (packagePolicyDoc) => { packagePolicyDoc.attributes.policy_id = packagePolicyDoc.attributes.config_id; + // @ts-expect-error delete packagePolicyDoc.attributes.config_id; return packagePolicyDoc; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/deserialize.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/deserialize.ts index 01788c49ec2f1..50f35becc52ba 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/deserialize.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/deserialize.ts @@ -91,6 +91,7 @@ export const deserializeVerboseTestOutput = ( // The tag is added programatically as a way to map // the results to each processor // It is not something we need to surface to the user, so we delete it + // @ts-expect-error delete result.tag; processorResultsById[resultId] = result; diff --git a/x-pack/plugins/lists/common/schemas/request/create_endpoint_list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/create_endpoint_list_item_schema.test.ts index e40a80a0d589d..624de2fb30d17 100644 --- a/x-pack/plugins/lists/common/schemas/request/create_endpoint_list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/create_endpoint_list_item_schema.test.ts @@ -31,6 +31,7 @@ describe('create_endpoint_list_item_schema', () => { test('it should fail validation when supplied an undefined for "description"', () => { const payload = getCreateEndpointListItemSchemaMock(); + // @ts-expect-error delete payload.description; const decoded = createEndpointListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -43,6 +44,7 @@ describe('create_endpoint_list_item_schema', () => { test('it should fail validation when supplied an undefined for "name"', () => { const payload = getCreateEndpointListItemSchemaMock(); + // @ts-expect-error delete payload.name; const decoded = createEndpointListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -55,6 +57,7 @@ describe('create_endpoint_list_item_schema', () => { test('it should fail validation when supplied an undefined for "type"', () => { const payload = getCreateEndpointListItemSchemaMock(); + // @ts-expect-error delete payload.type; const decoded = createEndpointListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -145,6 +148,7 @@ describe('create_endpoint_list_item_schema', () => { test('it should fail validation when supplied an undefined for "entries"', () => { const inputPayload = getCreateEndpointListItemSchemaMock(); const outputPayload = getCreateEndpointListItemSchemaMock(); + // @ts-expect-error delete inputPayload.entries; outputPayload.entries = []; const decoded = createEndpointListItemSchema.decode(inputPayload); diff --git a/x-pack/plugins/lists/common/schemas/request/create_exception_list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/create_exception_list_item_schema.test.ts index d2ad69d1ee7b6..4a4c3972dc1e3 100644 --- a/x-pack/plugins/lists/common/schemas/request/create_exception_list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/create_exception_list_item_schema.test.ts @@ -31,6 +31,7 @@ describe('create_exception_list_item_schema', () => { test('it should fail validation when supplied an undefined for "description"', () => { const payload = getCreateExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.description; const decoded = createExceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -43,6 +44,7 @@ describe('create_exception_list_item_schema', () => { test('it should fail validation when supplied an undefined for "name"', () => { const payload = getCreateExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.name; const decoded = createExceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -55,6 +57,7 @@ describe('create_exception_list_item_schema', () => { test('it should fail validation when supplied an undefined for "type"', () => { const payload = getCreateExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.type; const decoded = createExceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -67,6 +70,7 @@ describe('create_exception_list_item_schema', () => { test('it should fail validation when supplied an undefined for "list_id"', () => { const inputPayload = getCreateExceptionListItemSchemaMock(); + // @ts-expect-error delete inputPayload.list_id; const decoded = createExceptionListItemSchema.decode(inputPayload); const checked = exactCheck(inputPayload, decoded); @@ -133,6 +137,7 @@ describe('create_exception_list_item_schema', () => { test('it should fail validation when supplied an undefined for "entries"', () => { const inputPayload = getCreateExceptionListItemSchemaMock(); const outputPayload = getCreateExceptionListItemSchemaMock(); + // @ts-expect-error delete inputPayload.entries; outputPayload.entries = []; const decoded = createExceptionListItemSchema.decode(inputPayload); diff --git a/x-pack/plugins/lists/common/schemas/request/delete_endpoint_list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/delete_endpoint_list_item_schema.test.ts index fa3c1ef3b02f5..e881e8dd28adb 100644 --- a/x-pack/plugins/lists/common/schemas/request/delete_endpoint_list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/delete_endpoint_list_item_schema.test.ts @@ -30,6 +30,7 @@ describe('delete_endpoint_list_item_schema', () => { const payload: DeleteEndpointListItemSchema & { namespace_type: string; } = { ...getDeleteEndpointListItemSchemaMock(), namespace_type: 'single' }; + // @ts-expect-error delete payload.namespace_type; const decoded = deleteEndpointListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/request/delete_list_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/delete_list_schema.test.ts index 65ca2f3f457e9..d099bdcff6710 100644 --- a/x-pack/plugins/lists/common/schemas/request/delete_list_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/delete_list_schema.test.ts @@ -25,6 +25,7 @@ describe('delete_list_schema', () => { test('it should NOT accept an undefined for an id', () => { const payload = getDeleteListSchemaMock(); + // @ts-expect-error delete payload.id; const decoded = deleteListSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/request/export_list_item_query_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/export_list_item_query_schema.test.ts index cd6f4c1b147db..828544d392a3b 100644 --- a/x-pack/plugins/lists/common/schemas/request/export_list_item_query_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/export_list_item_query_schema.test.ts @@ -28,6 +28,7 @@ describe('export_list_item_schema', () => { test('it should NOT accept an undefined for an id', () => { const payload = getExportListItemQuerySchemaMock(); + // @ts-expect-error delete payload.list_id; const decoded = exportListItemQuerySchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/request/import_list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/import_list_item_schema.test.ts index 4de77b66610d3..a52824dd8be8e 100644 --- a/x-pack/plugins/lists/common/schemas/request/import_list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/import_list_item_schema.test.ts @@ -25,6 +25,7 @@ describe('import_list_item_schema', () => { test('it should NOT accept an undefined for a file', () => { const payload = getImportListItemSchemaMock(); + // @ts-expect-error delete payload.file; const decoded = importListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/request/patch_list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/patch_list_item_schema.test.ts index b148f19da8a86..35852954d5c46 100644 --- a/x-pack/plugins/lists/common/schemas/request/patch_list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/patch_list_item_schema.test.ts @@ -25,6 +25,7 @@ describe('patch_list_item_schema', () => { test('it should NOT accept an undefined for "id"', () => { const payload = getPathListItemSchemaMock(); + // @ts-expect-error delete payload.id; const decoded = patchListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/request/patch_list_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/patch_list_schema.test.ts index dea48df3f1702..7ce0a1c2d8086 100644 --- a/x-pack/plugins/lists/common/schemas/request/patch_list_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/patch_list_schema.test.ts @@ -25,6 +25,7 @@ describe('patch_list_schema', () => { test('it should NOT accept an undefined for "id"', () => { const payload = getPathListSchemaMock(); + // @ts-expect-error delete payload.id; const decoded = patchListSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/request/read_endpoint_list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/read_endpoint_list_item_schema.test.ts index adec476ea5ad7..a0e790bef6e1e 100644 --- a/x-pack/plugins/lists/common/schemas/request/read_endpoint_list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/read_endpoint_list_item_schema.test.ts @@ -52,6 +52,7 @@ describe('read_endpoint_list_item_schema', () => { const payload: ReadEndpointListItemSchema & { namespace_type: string; } = { ...getReadEndpointListItemSchemaMock(), namespace_type: 'single' }; + // @ts-expect-error delete payload.namespace_type; const decoded = readEndpointListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/request/read_list_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/read_list_schema.test.ts index 0b7e92c23f77a..2f234766aff01 100644 --- a/x-pack/plugins/lists/common/schemas/request/read_list_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/read_list_schema.test.ts @@ -25,6 +25,7 @@ describe('read_list_schema', () => { test('it should NOT accept an undefined for "id"', () => { const payload = getReadListSchemaMock(); + // @ts-expect-error delete payload.id; const decoded = readListSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/request/update_endpoint_list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/update_endpoint_list_item_schema.test.ts index ecbbb250a88f6..671e38ceb5266 100644 --- a/x-pack/plugins/lists/common/schemas/request/update_endpoint_list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/update_endpoint_list_item_schema.test.ts @@ -27,6 +27,7 @@ describe('update_endpoint_list_item_schema', () => { test('it should not accept an undefined for "description"', () => { const payload = getUpdateEndpointListItemSchemaMock(); + // @ts-expect-error delete payload.description; const decoded = updateEndpointListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -39,6 +40,7 @@ describe('update_endpoint_list_item_schema', () => { test('it should not accept an undefined for "name"', () => { const payload = getUpdateEndpointListItemSchemaMock(); + // @ts-expect-error delete payload.name; const decoded = updateEndpointListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -51,6 +53,7 @@ describe('update_endpoint_list_item_schema', () => { test('it should not accept an undefined for "type"', () => { const payload = getUpdateEndpointListItemSchemaMock(); + // @ts-expect-error delete payload.type; const decoded = updateEndpointListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -100,6 +103,7 @@ describe('update_endpoint_list_item_schema', () => { test('it should NOT accept an undefined for "entries"', () => { const inputPayload = getUpdateEndpointListItemSchemaMock(); const outputPayload = getUpdateEndpointListItemSchemaMock(); + // @ts-expect-error delete inputPayload.entries; outputPayload.entries = []; const decoded = updateEndpointListItemSchema.decode(inputPayload); diff --git a/x-pack/plugins/lists/common/schemas/request/update_exception_list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/update_exception_list_item_schema.test.ts index a49a5552603fd..da320a4983de3 100644 --- a/x-pack/plugins/lists/common/schemas/request/update_exception_list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/update_exception_list_item_schema.test.ts @@ -27,6 +27,7 @@ describe('update_exception_list_item_schema', () => { test('it should not accept an undefined for "description"', () => { const payload = getUpdateExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.description; const decoded = updateExceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -39,6 +40,7 @@ describe('update_exception_list_item_schema', () => { test('it should not accept an undefined for "name"', () => { const payload = getUpdateExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.name; const decoded = updateExceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -51,6 +53,7 @@ describe('update_exception_list_item_schema', () => { test('it should not accept an undefined for "type"', () => { const payload = getUpdateExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.type; const decoded = updateExceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -100,6 +103,7 @@ describe('update_exception_list_item_schema', () => { test('it should NOT accept an undefined for "entries"', () => { const inputPayload = getUpdateExceptionListItemSchemaMock(); const outputPayload = getUpdateExceptionListItemSchemaMock(); + // @ts-expect-error delete inputPayload.entries; outputPayload.entries = []; const decoded = updateExceptionListItemSchema.decode(inputPayload); diff --git a/x-pack/plugins/lists/common/schemas/request/update_exception_list_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/update_exception_list_schema.test.ts index 650cbd439ad2b..32f114ae34d8e 100644 --- a/x-pack/plugins/lists/common/schemas/request/update_exception_list_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/request/update_exception_list_schema.test.ts @@ -27,6 +27,7 @@ describe('update_exception_list_schema', () => { test('it should not accept an undefined for "description"', () => { const payload = getUpdateExceptionListSchemaMock(); + // @ts-expect-error delete payload.description; const decoded = updateExceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -39,6 +40,7 @@ describe('update_exception_list_schema', () => { test('it should not accept an undefined for "name"', () => { const payload = getUpdateExceptionListSchemaMock(); + // @ts-expect-error delete payload.name; const decoded = updateExceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -51,6 +53,7 @@ describe('update_exception_list_schema', () => { test('it should not accept an undefined for "type"', () => { const payload = getUpdateExceptionListSchemaMock(); + // @ts-expect-error delete payload.type; const decoded = updateExceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/response/acknowledge_schema.test.ts b/x-pack/plugins/lists/common/schemas/response/acknowledge_schema.test.ts index a59a93b06e34d..c735e8ebaeb89 100644 --- a/x-pack/plugins/lists/common/schemas/response/acknowledge_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/response/acknowledge_schema.test.ts @@ -24,6 +24,7 @@ describe('acknowledge_schema', () => { }); test('it should NOT accept an undefined for "ok"', () => { const payload = getAcknowledgeSchemaResponseMock(); + // @ts-expect-error delete payload.acknowledged; const decoded = acknowledgeSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/response/create_endpoint_list_schema.test.ts b/x-pack/plugins/lists/common/schemas/response/create_endpoint_list_schema.test.ts index 8c1392109979e..380a1e3a4cfd5 100644 --- a/x-pack/plugins/lists/common/schemas/response/create_endpoint_list_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/response/create_endpoint_list_schema.test.ts @@ -35,6 +35,7 @@ describe('create_endpoint_list_schema', () => { test('it should NOT accept an undefined for "list_id"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.list_id; const decoded = createEndpointListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -48,6 +49,7 @@ describe('create_endpoint_list_schema', () => { test('it should NOT allow missing fields', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.list_id; const decoded = createEndpointListSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/response/exception_list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/response/exception_list_item_schema.test.ts index 32b55104e4fdf..58c6ed029a5e8 100644 --- a/x-pack/plugins/lists/common/schemas/response/exception_list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/response/exception_list_item_schema.test.ts @@ -25,6 +25,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "id"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.id; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -36,6 +37,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "list_id"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.list_id; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -49,6 +51,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "item_id"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.item_id; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -62,6 +65,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "comments"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.comments; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -75,6 +79,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "entries"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.entries; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -88,6 +93,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "name"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.name; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -101,6 +107,7 @@ describe('exception_list_item_schema', () => { test('it should accept an undefined for "namespace_type" and return "single" as a default value for "namespace_type"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.namespace_type; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -112,6 +119,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "description"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.description; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -136,6 +144,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "created_at"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.created_at; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -149,6 +158,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "created_by"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.created_by; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -162,6 +172,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "tie_breaker_id"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.tie_breaker_id; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -175,6 +186,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "type"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.type; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -188,6 +200,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "updated_at"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.updated_at; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -201,6 +214,7 @@ describe('exception_list_item_schema', () => { test('it should NOT accept an undefined for "updated_by"', () => { const payload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.updated_by; const decoded = exceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/response/exception_list_schema.test.ts b/x-pack/plugins/lists/common/schemas/response/exception_list_schema.test.ts index 1b5ef08b02d5f..934ff070561f6 100644 --- a/x-pack/plugins/lists/common/schemas/response/exception_list_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/response/exception_list_schema.test.ts @@ -25,6 +25,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "id"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.id; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -36,6 +37,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "list_id"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.list_id; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -49,6 +51,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "name"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.name; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -62,6 +65,7 @@ describe('exception_list_schema', () => { test('it should accept an undefined for "namespace_type" and make "namespace_type" that of "single"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.namespace_type; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -73,6 +77,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "description"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.description; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -97,6 +102,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "created_at"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.created_at; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -110,6 +116,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "created_by"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.created_by; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -123,6 +130,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "tie_breaker_id"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.tie_breaker_id; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -136,6 +144,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "type"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.type; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -149,6 +158,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "updated_at"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.updated_at; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -162,6 +172,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "updated_by"', () => { const payload = getExceptionListSchemaMock(); + // @ts-expect-error delete payload.updated_by; const decoded = exceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/response/found_exception_list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/response/found_exception_list_item_schema.test.ts index 5da3accccd9c2..46fc655614411 100644 --- a/x-pack/plugins/lists/common/schemas/response/found_exception_list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/response/found_exception_list_item_schema.test.ts @@ -87,6 +87,7 @@ describe('found_exception_list_item_schema', () => { test('it should NOT accept an undefined for "page"', () => { const payload = getFoundExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.page; const decoded = foundExceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -100,6 +101,7 @@ describe('found_exception_list_item_schema', () => { test('it should NOT accept an undefined for "per_page"', () => { const payload = getFoundExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.per_page; const decoded = foundExceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -113,6 +115,7 @@ describe('found_exception_list_item_schema', () => { test('it should NOT accept an undefined for "total"', () => { const payload = getFoundExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.total; const decoded = foundExceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -126,6 +129,7 @@ describe('found_exception_list_item_schema', () => { test('it should NOT accept an undefined for "data"', () => { const payload = getFoundExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.data; const decoded = foundExceptionListItemSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/response/found_exception_list_schema.test.ts b/x-pack/plugins/lists/common/schemas/response/found_exception_list_schema.test.ts index d4fa8ee0e3481..c367cec02d58b 100644 --- a/x-pack/plugins/lists/common/schemas/response/found_exception_list_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/response/found_exception_list_schema.test.ts @@ -84,6 +84,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "page"', () => { const payload = getFoundExceptionListSchemaMock(); + // @ts-expect-error delete payload.page; const decoded = foundExceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -97,6 +98,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "per_page"', () => { const payload = getFoundExceptionListSchemaMock(); + // @ts-expect-error delete payload.per_page; const decoded = foundExceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -110,6 +112,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "total"', () => { const payload = getFoundExceptionListSchemaMock(); + // @ts-expect-error delete payload.total; const decoded = foundExceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -123,6 +126,7 @@ describe('exception_list_schema', () => { test('it should NOT accept an undefined for "data"', () => { const payload = getFoundExceptionListSchemaMock(); + // @ts-expect-error delete payload.data; const decoded = foundExceptionListSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/response/list_item_index_exist_schema.test.ts b/x-pack/plugins/lists/common/schemas/response/list_item_index_exist_schema.test.ts index 2b072d8f95cd8..4732da0213934 100644 --- a/x-pack/plugins/lists/common/schemas/response/list_item_index_exist_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/response/list_item_index_exist_schema.test.ts @@ -25,6 +25,7 @@ describe('list_item_index_exist_schema', () => { test('it should NOT accept an undefined for "list_index"', () => { const payload = getListItemIndexExistSchemaResponseMock(); + // @ts-expect-error delete payload.list_index; const decoded = listItemIndexExistSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -38,6 +39,7 @@ describe('list_item_index_exist_schema', () => { test('it should NOT accept an undefined for "list_item_index"', () => { const payload = getListItemIndexExistSchemaResponseMock(); + // @ts-expect-error delete payload.list_item_index; const decoded = listItemIndexExistSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/response/list_item_schema.test.ts b/x-pack/plugins/lists/common/schemas/response/list_item_schema.test.ts index ec4c8d2c2d1ea..47f2e29fcb5ef 100644 --- a/x-pack/plugins/lists/common/schemas/response/list_item_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/response/list_item_schema.test.ts @@ -25,6 +25,7 @@ describe('list_item_schema', () => { test('it should NOT accept an undefined for "id"', () => { const payload = getListItemResponseMock(); + // @ts-expect-error delete payload.id; const decoded = listItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -36,6 +37,7 @@ describe('list_item_schema', () => { test('it should NOT accept an undefined for "list_id"', () => { const payload = getListItemResponseMock(); + // @ts-expect-error delete payload.list_id; const decoded = listItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -82,6 +84,7 @@ describe('list_item_schema', () => { test('it should NOT accept an undefined for "created_at"', () => { const payload = getListItemResponseMock(); + // @ts-expect-error delete payload.created_at; const decoded = listItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -95,6 +98,7 @@ describe('list_item_schema', () => { test('it should NOT accept an undefined for "created_by"', () => { const payload = getListItemResponseMock(); + // @ts-expect-error delete payload.created_by; const decoded = listItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -108,6 +112,7 @@ describe('list_item_schema', () => { test('it should NOT accept an undefined for "tie_breaker_id"', () => { const payload = getListItemResponseMock(); + // @ts-expect-error delete payload.tie_breaker_id; const decoded = listItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -121,6 +126,7 @@ describe('list_item_schema', () => { test('it should NOT accept an undefined for "type"', () => { const payload = getListItemResponseMock(); + // @ts-expect-error delete payload.type; const decoded = listItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -134,6 +140,7 @@ describe('list_item_schema', () => { test('it should NOT accept an undefined for "updated_at"', () => { const payload = getListItemResponseMock(); + // @ts-expect-error delete payload.updated_at; const decoded = listItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -147,6 +154,7 @@ describe('list_item_schema', () => { test('it should NOT accept an undefined for "updated_by"', () => { const payload = getListItemResponseMock(); + // @ts-expect-error delete payload.updated_by; const decoded = listItemSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -160,6 +168,7 @@ describe('list_item_schema', () => { test('it should NOT accept an undefined for "value"', () => { const payload = getListItemResponseMock(); + // @ts-expect-error delete payload.value; const decoded = listItemSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/response/list_schema.test.ts b/x-pack/plugins/lists/common/schemas/response/list_schema.test.ts index 87e56e5dd95ac..ab1d17b97c57d 100644 --- a/x-pack/plugins/lists/common/schemas/response/list_schema.test.ts +++ b/x-pack/plugins/lists/common/schemas/response/list_schema.test.ts @@ -25,6 +25,7 @@ describe('list_schema', () => { test('it should NOT accept an undefined for "id"', () => { const payload = getListResponseMock(); + // @ts-expect-error delete payload.id; const decoded = listSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -69,6 +70,7 @@ describe('list_schema', () => { test('it should NOT accept an undefined for "created_at"', () => { const payload = getListResponseMock(); + // @ts-expect-error delete payload.created_at; const decoded = listSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -82,6 +84,7 @@ describe('list_schema', () => { test('it should NOT accept an undefined for "created_by"', () => { const payload = getListResponseMock(); + // @ts-expect-error delete payload.created_by; const decoded = listSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -95,6 +98,7 @@ describe('list_schema', () => { test('it should NOT accept an undefined for "tie_breaker_id"', () => { const payload = getListResponseMock(); + // @ts-expect-error delete payload.tie_breaker_id; const decoded = listSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -108,6 +112,7 @@ describe('list_schema', () => { test('it should NOT accept an undefined for "type"', () => { const payload = getListResponseMock(); + // @ts-expect-error delete payload.type; const decoded = listSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -121,6 +126,7 @@ describe('list_schema', () => { test('it should NOT accept an undefined for "updated_at"', () => { const payload = getListResponseMock(); + // @ts-expect-error delete payload.updated_at; const decoded = listSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -134,6 +140,7 @@ describe('list_schema', () => { test('it should NOT accept an undefined for "updated_by"', () => { const payload = getListResponseMock(); + // @ts-expect-error delete payload.updated_by; const decoded = listSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -147,6 +154,7 @@ describe('list_schema', () => { test('it should NOT accept an undefined for "name"', () => { const payload = getListResponseMock(); + // @ts-expect-error delete payload.name; const decoded = listSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -160,6 +168,7 @@ describe('list_schema', () => { test('it should NOT accept an undefined for "description"', () => { const payload = getListResponseMock(); + // @ts-expect-error delete payload.description; const decoded = listSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/lists/common/schemas/types/update_comment.test.ts b/x-pack/plugins/lists/common/schemas/types/update_comment.test.ts index ba07421fe60f4..6b2f70506a81f 100644 --- a/x-pack/plugins/lists/common/schemas/types/update_comment.test.ts +++ b/x-pack/plugins/lists/common/schemas/types/update_comment.test.ts @@ -32,6 +32,7 @@ describe('CommentsUpdate', () => { test('it should fail validation when supplied an undefined for "comment"', () => { const payload = getUpdateCommentMock(); + // @ts-expect-error delete payload.comment; const decoded = updateComment.decode(payload); const message = pipe(decoded, foldLeftRight); diff --git a/x-pack/plugins/lists/public/exceptions/api.test.ts b/x-pack/plugins/lists/public/exceptions/api.test.ts index 457a8708ec341..7e79b212f69cb 100644 --- a/x-pack/plugins/lists/public/exceptions/api.test.ts +++ b/x-pack/plugins/lists/public/exceptions/api.test.ts @@ -89,6 +89,7 @@ describe('Exceptions Lists API', () => { test('it returns error if response payload fails decode', async () => { const payload = getCreateExceptionListSchemaMock(); const badPayload = getExceptionListSchemaMock(); + // @ts-expect-error delete badPayload.id; httpMock.fetch.mockResolvedValue(badPayload); @@ -150,6 +151,7 @@ describe('Exceptions Lists API', () => { test('it returns error if response payload fails decode', async () => { const payload = getCreateExceptionListItemSchemaMock(); const badPayload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete badPayload.id; httpMock.fetch.mockResolvedValue(badPayload); @@ -196,6 +198,7 @@ describe('Exceptions Lists API', () => { test('it returns error and does not make request if request payload fails decode', async () => { const payload = getUpdateExceptionListSchemaMock(); + // @ts-expect-error delete payload.description; await expect( @@ -210,6 +213,7 @@ describe('Exceptions Lists API', () => { test('it returns error if response payload fails decode', async () => { const payload = getUpdateExceptionListSchemaMock(); const badPayload = getExceptionListSchemaMock(); + // @ts-expect-error delete badPayload.id; httpMock.fetch.mockResolvedValue(badPayload); @@ -256,6 +260,7 @@ describe('Exceptions Lists API', () => { test('it returns error and does not make request if request payload fails decode', async () => { const payload = getUpdateExceptionListItemSchemaMock(); + // @ts-expect-error delete payload.description; await expect( @@ -270,6 +275,7 @@ describe('Exceptions Lists API', () => { test('it returns error if response payload fails decode', async () => { const payload = getUpdateExceptionListItemSchemaMock(); const badPayload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete badPayload.id; httpMock.fetch.mockResolvedValue(badPayload); @@ -329,6 +335,7 @@ describe('Exceptions Lists API', () => { test('it returns error if response payload fails decode', async () => { const badPayload = getExceptionListSchemaMock(); + // @ts-expect-error delete badPayload.id; httpMock.fetch.mockResolvedValue(badPayload); @@ -532,6 +539,7 @@ describe('Exceptions Lists API', () => { test('it returns error if response payload fails decode', async () => { const badPayload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete badPayload.id; httpMock.fetch.mockResolvedValue(badPayload); @@ -599,6 +607,7 @@ describe('Exceptions Lists API', () => { test('it returns error if response payload fails decode', async () => { const badPayload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete badPayload.id; httpMock.fetch.mockResolvedValue(badPayload); @@ -659,6 +668,7 @@ describe('Exceptions Lists API', () => { test('it returns error if response payload fails decode', async () => { const badPayload = getExceptionListSchemaMock(); + // @ts-expect-error delete badPayload.id; httpMock.fetch.mockResolvedValue(badPayload); @@ -719,6 +729,7 @@ describe('Exceptions Lists API', () => { test('it returns error if response payload fails decode', async () => { const badPayload = getExceptionListItemSchemaMock(); + // @ts-expect-error delete badPayload.id; httpMock.fetch.mockResolvedValue(badPayload); diff --git a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx index e64d20138cfb8..52dc89a6bba58 100644 --- a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx +++ b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx @@ -36,7 +36,8 @@ export const sourceTitle = i18n.translate( } ); -export class MVTSingleLayerVectorSource extends AbstractSource +export class MVTSingleLayerVectorSource + extends AbstractSource implements ITiledSingleLayerVectorSource { static createDescriptor({ urlTemplate, diff --git a/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_style_property.tsx b/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_style_property.tsx index 826acd41e27a9..b16755e69f92d 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_style_property.tsx +++ b/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_style_property.tsx @@ -50,7 +50,8 @@ export interface IDynamicStyleProperty extends IStyleProperty { export type FieldFormatter = (value: string | number | undefined) => string | number; -export class DynamicStyleProperty extends AbstractStyleProperty +export class DynamicStyleProperty + extends AbstractStyleProperty implements IDynamicStyleProperty { static type = STYLE_TYPE.DYNAMIC; diff --git a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/combined_job.ts b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/combined_job.ts index 6df7643c5221f..42dee46e71fd6 100644 --- a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/combined_job.ts +++ b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/combined_job.ts @@ -29,6 +29,7 @@ export function expandCombinedJobConfig(combinedJob: CombinedJob) { const combinedJobClone = cloneDeep(combinedJob); const job = combinedJobClone; const datafeed = combinedJobClone.datafeed_config; + // @ts-expect-error delete job.datafeed_config; return { job, datafeed }; diff --git a/x-pack/plugins/ml/common/types/custom_urls.ts b/x-pack/plugins/ml/common/types/custom_urls.ts index b6b074934cc63..e20e16bae87f2 100644 --- a/x-pack/plugins/ml/common/types/custom_urls.ts +++ b/x-pack/plugins/ml/common/types/custom_urls.ts @@ -15,7 +15,7 @@ export interface BaseUrlConfig { } export interface KibanaUrlConfig extends BaseUrlConfig { - time_range: string; + time_range?: string; } export type UrlConfig = BaseUrlConfig | KibanaUrlConfig; diff --git a/x-pack/plugins/ml/public/application/util/custom_url_utils.ts b/x-pack/plugins/ml/public/application/util/custom_url_utils.ts index 9c843af36192e..8263def2034aa 100644 --- a/x-pack/plugins/ml/public/application/util/custom_url_utils.ts +++ b/x-pack/plugins/ml/public/application/util/custom_url_utils.ts @@ -34,7 +34,9 @@ export function replaceTokensInUrlValue( const urlValue = customUrlConfig.url_value; const timestamp = doc[timeFieldName]; const timeRangeInterval = - 'time_range' in customUrlConfig ? parseInterval(customUrlConfig.time_range) : null; + 'time_range' in customUrlConfig && customUrlConfig.time_range + ? parseInterval(customUrlConfig.time_range) + : null; const record = { ...doc } as CustomUrlAnomalyRecordDoc; if (urlValue.includes('$earliest$')) { const earliestMoment = moment(timestamp); diff --git a/x-pack/plugins/ml/server/models/calendar/calendar_manager.ts b/x-pack/plugins/ml/server/models/calendar/calendar_manager.ts index 43f4dc3cba7e2..b461e71c006ff 100644 --- a/x-pack/plugins/ml/server/models/calendar/calendar_manager.ts +++ b/x-pack/plugins/ml/server/models/calendar/calendar_manager.ts @@ -70,13 +70,10 @@ export class CalendarManager { } async newCalendar(calendar: FormCalendar) { - const calendarId = calendar.calendarId; - const events = calendar.events; - delete calendar.calendarId; - delete calendar.events; + const { calendarId, events, ...newCalendar } = calendar; await this._callAsInternalUser('ml.addCalendar', { calendarId, - body: calendar, + body: newCalendar, }); if (events.length) { diff --git a/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts b/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts index 21e178dcc7e76..cc42a545c11e2 100644 --- a/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts +++ b/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts @@ -1209,6 +1209,7 @@ export class DataRecognizer { const job = jobs.find((j) => j.id === `${jobPrefix}${jobSpecificOverride.job_id}`); if (job !== undefined) { // delete the job_id in the override as this shouldn't be overridden + // @ts-expect-error delete jobSpecificOverride.job_id; merge(job.config, jobSpecificOverride); processArrayValues(job.config, jobSpecificOverride); diff --git a/x-pack/plugins/ml/server/models/filter/filter_manager.ts b/x-pack/plugins/ml/server/models/filter/filter_manager.ts index 20dc95e92a86c..768ca1f893b68 100644 --- a/x-pack/plugins/ml/server/models/filter/filter_manager.ts +++ b/x-pack/plugins/ml/server/models/filter/filter_manager.ts @@ -136,11 +136,10 @@ export class FilterManager { } async newFilter(filter: FormFilter) { - const filterId = filter.filterId; - delete filter.filterId; + const { filterId, ...body } = filter; try { // Returns the newly created filter. - return await this._callAsInternalUser('ml.addFilter', { filterId, body: filter }); + return await this._callAsInternalUser('ml.addFilter', { filterId, body }); } catch (error) { throw Boom.badRequest(error); } diff --git a/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.test.ts b/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.test.ts index 61af960847f7f..6ffb0e320982b 100644 --- a/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.test.ts +++ b/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.test.ts @@ -208,6 +208,7 @@ describe('ML - validateModelMemoryLimit', () => { const dtrs = createDetectors(2); const job = getJobConfig(['instance'], dtrs); const duration = { start: 0, end: 1 }; + // @ts-expect-error delete mlInfoResponse.limits.max_model_memory_limit; // @ts-expect-error job.analysis_limits.model_memory_limit = '10mb'; diff --git a/x-pack/plugins/searchprofiler/public/application/store/reducer.ts b/x-pack/plugins/searchprofiler/public/application/store/reducer.ts index 5366dcec3fcf0..8b2f14b3ed45a 100644 --- a/x-pack/plugins/searchprofiler/public/application/store/reducer.ts +++ b/x-pack/plugins/searchprofiler/public/application/store/reducer.ts @@ -39,7 +39,7 @@ export const reducer: Reducer = (state, action) => { indexName: value.indexName, operation: Object.freeze(restOfOperation), // prettier-ignore - shardName: `[${/* shard id */value.shard.id[0]}][${/* shard number */value.shard.id[2] }]` + shardName: `[${/* shard id */value.shard.id[0]}][${/* shard number */value.shard.id[2] }]`, }; } else { nextState.highlightDetails = null; diff --git a/x-pack/plugins/security/common/model/user.ts b/x-pack/plugins/security/common/model/user.ts index ae6de7f4c5fbc..6e68f125f6f71 100644 --- a/x-pack/plugins/security/common/model/user.ts +++ b/x-pack/plugins/security/common/model/user.ts @@ -18,8 +18,8 @@ export interface User { } export interface EditUser extends User { - password: string; - confirmPassword: string; + password?: string; + confirmPassword?: string; } export function getUserDisplayName(user: User) { diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_api_client.ts b/x-pack/plugins/security/public/management/role_mappings/role_mappings_api_client.ts index 8e8bae42d4ad8..5eec3a0cfba37 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_api_client.ts +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_api_client.ts @@ -36,13 +36,11 @@ export class RoleMappingsAPIClient { } public async saveRoleMapping(roleMapping: RoleMapping) { - const payload = { ...roleMapping }; - delete payload.name; + const { name, ...payload } = roleMapping; - return this.http.post( - `/internal/security/role_mapping/${encodeURIComponent(roleMapping.name)}`, - { body: JSON.stringify(payload) } - ); + return this.http.post(`/internal/security/role_mapping/${encodeURIComponent(name)}`, { + body: JSON.stringify(payload), + }); } public async deleteRoleMappings(names: string[]): Promise { diff --git a/x-pack/plugins/security/public/management/roles/roles_api_client.ts b/x-pack/plugins/security/public/management/roles/roles_api_client.ts index 50c490d2924ba..444f1eaaaf364 100644 --- a/x-pack/plugins/security/public/management/roles/roles_api_client.ts +++ b/x-pack/plugins/security/public/management/roles/roles_api_client.ts @@ -52,6 +52,7 @@ export class RolesAPIClient { } }); + // @ts-expect-error delete role.name; delete role.transient_metadata; delete role._unrecognized_applications; diff --git a/x-pack/plugins/security/server/session_management/session_cookie.test.ts b/x-pack/plugins/security/server/session_management/session_cookie.test.ts index 584988d201a22..cccdde0cc004f 100644 --- a/x-pack/plugins/security/server/session_management/session_cookie.test.ts +++ b/x-pack/plugins/security/server/session_management/session_cookie.test.ts @@ -110,6 +110,7 @@ describe('Session cookie', () => { it('returns `null` and clears session value if it is in incompatible format', async () => { const invalidValue = sessionCookieMock.createValue(); + // @ts-expect-error delete invalidValue.sid; mockSessionStorage.get.mockResolvedValue(invalidValue); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/add_prepackged_rules_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/add_prepackged_rules_schema.test.ts index 95297124b563a..137b40eb648ba 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/add_prepackged_rules_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/add_prepackged_rules_schema.test.ts @@ -618,6 +618,7 @@ describe('add prepackaged rules schema', () => { test('rule_id is required', () => { const payload: AddPrepackagedRulesSchema = getAddPrepackagedRulesSchemaMock(); + // @ts-expect-error delete payload.rule_id; const decoded = addPrepackagedRulesSchema.decode(payload); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/create_rules_bulk_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/create_rules_bulk_schema.test.ts index d335cafdb7885..5c086511e6760 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/create_rules_bulk_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/create_rules_bulk_schema.test.ts @@ -73,6 +73,7 @@ describe('create_rules_bulk_schema', () => { test('single array element with a missing value (risk_score) will not validate', () => { const singleItem = getCreateRulesSchemaMock(); + // @ts-expect-error delete singleItem.risk_score; const payload: CreateRulesBulkSchema = [singleItem]; @@ -88,6 +89,7 @@ describe('create_rules_bulk_schema', () => { test('two array elements where the first is valid but the second is invalid (risk_score) will not validate', () => { const singleItem = getCreateRulesSchemaMock(); const secondItem = getCreateRulesSchemaMock(); + // @ts-expect-error delete secondItem.risk_score; const payload: CreateRulesBulkSchema = [singleItem, secondItem]; @@ -103,6 +105,7 @@ describe('create_rules_bulk_schema', () => { test('two array elements where the first is invalid (risk_score) but the second is valid will not validate', () => { const singleItem = getCreateRulesSchemaMock(); const secondItem = getCreateRulesSchemaMock(); + // @ts-expect-error delete singleItem.risk_score; const payload: CreateRulesBulkSchema = [singleItem, secondItem]; @@ -118,7 +121,9 @@ describe('create_rules_bulk_schema', () => { test('two array elements where both are invalid (risk_score) will not validate', () => { const singleItem = getCreateRulesSchemaMock(); const secondItem = getCreateRulesSchemaMock(); + // @ts-expect-error delete singleItem.risk_score; + // @ts-expect-error delete secondItem.risk_score; const payload: CreateRulesBulkSchema = [singleItem, secondItem]; diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/import_rules_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/import_rules_schema.test.ts index db2e9acc4615f..0515bee0052d7 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/import_rules_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/import_rules_schema.test.ts @@ -1178,6 +1178,7 @@ describe('import rules schema', () => { ...getImportRulesSchemaMock(), id: 'c4e80a0d-e20f-4efc-84c1-08112da5a612', }; + // @ts-expect-error delete payload.rule_id; const decoded = importRulesSchema.decode(payload); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/update_rules_bulk_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/update_rules_bulk_schema.test.ts index 33a22d9a5f805..a82a3abc8c0ac 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/update_rules_bulk_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/update_rules_bulk_schema.test.ts @@ -69,6 +69,7 @@ describe('update_rules_bulk_schema', () => { test('single array element with a missing value (risk_score) will not validate', () => { const singleItem = getUpdateRulesSchemaMock(); + // @ts-expect-error delete singleItem.risk_score; const payload: UpdateRulesBulkSchema = [singleItem]; @@ -84,6 +85,7 @@ describe('update_rules_bulk_schema', () => { test('two array elements where the first is valid but the second is invalid (risk_score) will not validate', () => { const singleItem = getUpdateRulesSchemaMock(); const secondItem = getUpdateRulesSchemaMock(); + // @ts-expect-error delete secondItem.risk_score; const payload: UpdateRulesBulkSchema = [singleItem, secondItem]; @@ -99,6 +101,7 @@ describe('update_rules_bulk_schema', () => { test('two array elements where the first is invalid (risk_score) but the second is valid will not validate', () => { const singleItem = getUpdateRulesSchemaMock(); const secondItem = getUpdateRulesSchemaMock(); + // @ts-expect-error delete singleItem.risk_score; const payload: UpdateRulesBulkSchema = [singleItem, secondItem]; @@ -114,7 +117,9 @@ describe('update_rules_bulk_schema', () => { test('two array elements where both are invalid (risk_score) will not validate', () => { const singleItem = getUpdateRulesSchemaMock(); const secondItem = getUpdateRulesSchemaMock(); + // @ts-expect-error delete singleItem.risk_score; + // @ts-expect-error delete secondItem.risk_score; const payload: UpdateRulesBulkSchema = [singleItem, secondItem]; diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/error_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/error_schema.test.ts index d9e16105351bd..460ea0584cc3d 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/error_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/error_schema.test.ts @@ -47,6 +47,7 @@ describe('error_schema', () => { test('it should NOT validate an error when it has required elements deleted from it', () => { const error = getErrorSchemaMock(); + // @ts-expect-error delete error.error; const decoded = errorSchema.decode(error); const checked = exactCheck(error, decoded); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/find_rules_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/find_rules_schema.test.ts index fc1ab9b87795d..4db1e081c5610 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/find_rules_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/find_rules_schema.test.ts @@ -65,6 +65,7 @@ describe('find_rules_schema', () => { test('it should invalidate a typical single find rules response if the rule is missing a required field such as name', () => { const payload = getFindRulesSchemaMock(); const invalidRule = getRulesSchemaMock(); + // @ts-expect-error delete invalidRule.name; payload.data = [invalidRule]; const decoded = findRulesSchema.decode(payload); @@ -79,6 +80,7 @@ describe('find_rules_schema', () => { test('it should invalidate a typical single find rules response if it is missing perPage', () => { const payload = getFindRulesSchemaMock(); + // @ts-expect-error delete payload.perPage; const decoded = findRulesSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/prepackaged_rules_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/prepackaged_rules_schema.test.ts index 61d3ede852ee1..f5c1a51b633cc 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/prepackaged_rules_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/prepackaged_rules_schema.test.ts @@ -86,6 +86,7 @@ describe('prepackaged_rules_schema', () => { timelines_installed: 0, timelines_updated: 0, }; + // @ts-expect-error delete payload.rules_installed; const decoded = prePackagedRulesAndTimelinesSchema.decode(payload); const checked = exactCheck(payload, decoded); @@ -104,6 +105,7 @@ describe('prepackaged_rules_schema', () => { timelines_installed: 0, timelines_updated: 0, }; + // @ts-expect-error delete payload.rules_updated; const decoded = prePackagedRulesAndTimelinesSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/prepackaged_rules_status_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/prepackaged_rules_status_schema.test.ts index 09cb7148fe90a..7931f1c7eca51 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/prepackaged_rules_status_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/prepackaged_rules_status_schema.test.ts @@ -141,6 +141,7 @@ describe('prepackaged_rules_schema', () => { timelines_not_installed: 0, timelines_not_updated: 0, }; + // @ts-expect-error delete payload.rules_installed; const decoded = prePackagedRulesAndTimelinesStatusSchema.decode(payload); const checked = exactCheck(payload, decoded); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/rules_bulk_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/rules_bulk_schema.test.ts index a169ac3deb9b9..3541fed7458e2 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/rules_bulk_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/rules_bulk_schema.test.ts @@ -49,6 +49,7 @@ describe('prepackaged_rule_schema', () => { test('it should NOT validate a rule with a deleted value', () => { const rule = getRulesSchemaMock(); + // @ts-expect-error delete rule.name; const payload: RulesBulkSchema = [rule]; const decoded = rulesBulkSchema.decode(payload); @@ -64,6 +65,7 @@ describe('prepackaged_rule_schema', () => { test('it should NOT validate an invalid error message with a deleted value', () => { const error = getErrorSchemaMock('fake id'); + // @ts-expect-error delete error.error; const payload: RulesBulkSchema = [error]; const decoded = rulesBulkSchema.decode(payload); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.test.ts index 7a2c167bfd855..d7cda0790bda5 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.test.ts @@ -41,6 +41,7 @@ describe('Lists', () => { test('it should NOT validate a list without an "id"', () => { const payload = getListMock(); + // @ts-expect-error delete payload.id; const decoded = list.decode(payload); const message = pipe(decoded, foldLeftRight); @@ -53,6 +54,7 @@ describe('Lists', () => { test('it should NOT validate a list without "namespace_type"', () => { const payload = getListMock(); + // @ts-expect-error delete payload.namespace_type; const decoded = list.decode(payload); const message = pipe(decoded, foldLeftRight); diff --git a/x-pack/plugins/security_solution/public/cases/components/user_action_tree/index.tsx b/x-pack/plugins/security_solution/public/cases/components/user_action_tree/index.tsx index 733e3db3c25e6..d1263ab13f41b 100644 --- a/x-pack/plugins/security_solution/public/cases/components/user_action_tree/index.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/user_action_tree/index.tsx @@ -56,7 +56,7 @@ export const UserActionTree = React.memo( updateCase, userCanCrud, }: UserActionTreeProps) => { - const { commentId } = useParams(); + const { commentId } = useParams<{ commentId?: string }>(); const handlerTimeoutId = useRef(0); const addCommentRef = useRef(null); const [initLoading, setInitLoading] = useState(true); diff --git a/x-pack/plugins/security_solution/public/cases/components/user_action_tree/user_action_title.tsx b/x-pack/plugins/security_solution/public/cases/components/user_action_tree/user_action_title.tsx index 0bd6100b05df6..9477299e563a8 100644 --- a/x-pack/plugins/security_solution/public/cases/components/user_action_tree/user_action_title.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/user_action_tree/user_action_title.tsx @@ -65,7 +65,7 @@ export const UserActionTitle = ({ updatedAt, username = i18n.UNKNOWN, }: UserActionTitleProps) => { - const { detailName: caseId } = useParams(); + const { detailName: caseId } = useParams<{ detailName: string }>(); const urlSearch = useGetUrlSearch(navTabs.case); const propertyActions = useMemo(() => { return [ diff --git a/x-pack/plugins/security_solution/public/cases/pages/case_details.tsx b/x-pack/plugins/security_solution/public/cases/pages/case_details.tsx index c3538f0c18ed5..0d41e22719bba 100644 --- a/x-pack/plugins/security_solution/public/cases/pages/case_details.tsx +++ b/x-pack/plugins/security_solution/public/cases/pages/case_details.tsx @@ -20,7 +20,7 @@ import { savedObjectReadOnlyErrorMessage, CaseCallOut } from '../components/call export const CaseDetailsPage = React.memo(() => { const history = useHistory(); const userPermissions = useGetUserSavedObjectPermissions(); - const { detailName: caseId } = useParams(); + const { detailName: caseId } = useParams<{ detailName?: string }>(); const search = useGetUrlSearch(navTabs.case); if (userPermissions != null && !userPermissions.read) { diff --git a/x-pack/plugins/security_solution/public/common/components/header_section/index.tsx b/x-pack/plugins/security_solution/public/common/components/header_section/index.tsx index f49001bd5d7af..df655bf179f5b 100644 --- a/x-pack/plugins/security_solution/public/common/components/header_section/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/header_section/index.tsx @@ -19,11 +19,11 @@ interface HeaderProps { const Header = styled.header.attrs(() => ({ className: 'siemHeaderSection', }))` -${({ height }) => - height && - css` - height: ${height}px; - `} + ${({ height }) => + height && + css` + height: ${height}px; + `} margin-bottom: ${({ height, theme }) => (height ? 0 : theme.eui.euiSizeL)}; user-select: text; diff --git a/x-pack/plugins/security_solution/public/common/components/utility_bar/styles.tsx b/x-pack/plugins/security_solution/public/common/components/utility_bar/styles.tsx index dd6b66350052e..0efd27c6ecbc6 100644 --- a/x-pack/plugins/security_solution/public/common/components/utility_bar/styles.tsx +++ b/x-pack/plugins/security_solution/public/common/components/utility_bar/styles.tsx @@ -26,13 +26,11 @@ export const Bar = styled.aside.attrs({ className: 'siemUtilityBar', })` ${({ border, theme }) => css` - ${ - border && - css` - border-bottom: ${theme.eui.euiBorderThin}; - padding-bottom: ${theme.eui.paddingSizes.s}; - ` - } + ${border && + css` + border-bottom: ${theme.eui.euiBorderThin}; + padding-bottom: ${theme.eui.paddingSizes.s}; + `} @media only screen and (min-width: ${theme.eui.euiBreakpoints.l}) { display: flex; diff --git a/x-pack/plugins/security_solution/public/common/hooks/endpoint/ingest_enabled.ts b/x-pack/plugins/security_solution/public/common/hooks/endpoint/ingest_enabled.ts index c201d85a270c0..e48f48e501903 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/endpoint/ingest_enabled.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/endpoint/ingest_enabled.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +import { ApplicationStart } from 'src/core/public'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; - /** * Returns an object which ingest permissions are allowed */ @@ -15,12 +15,12 @@ export const useIngestEnabledCheck = (): { write: boolean; read: boolean; } => { - const { services } = useKibana(); + const { services } = useKibana<{ application: ApplicationStart }>(); // Check if Ingest Manager is present in the configuration - const show = services.application.capabilities.ingestManager?.show ?? false; - const write = services.application.capabilities.ingestManager?.write ?? false; - const read = services.application.capabilities.ingestManager?.read ?? false; + const show = Boolean(services.application.capabilities.ingestManager?.show); + const write = Boolean(services.application.capabilities.ingestManager?.write); + const read = Boolean(services.application.capabilities.ingestManager?.read); // Check if all Ingest Manager permissions are enabled const allEnabled = show && read && write ? true : false; diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts index 4f2055424ca61..d6dc97fbae158 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts @@ -132,6 +132,7 @@ describe('helpers', () => { const mockStepData = { ...mockData, }; + // @ts-expect-error delete mockStepData.timeline.id; const result: DefineStepRuleJson = formatDefineStepData(mockStepData); @@ -180,6 +181,7 @@ describe('helpers', () => { id: '86aa74d0-2136-11ea-9864-ebc8cc1cb8c2', }, }; + // @ts-expect-error delete mockStepData.timeline.title; const result: DefineStepRuleJson = formatDefineStepData(mockStepData); diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx index 8a969a4cf098c..f48dc64966bfc 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx @@ -138,7 +138,7 @@ export const RuleDetailsPageComponent: FC = ({ needsConfiguration: needsListsConfiguration, } = useListsConfig(); const loading = userInfoLoading || listsConfigLoading; - const { detailName: ruleId } = useParams(); + const { detailName: ruleId } = useParams<{ detailName: string }>(); const { rule: maybeRule, refresh: refreshRule, loading: ruleLoading } = useRuleAsync(ruleId); const [rule, setRule] = useState(null); const isLoading = ruleLoading && rule == null; diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/edit/index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/edit/index.tsx index 13855a4b81494..4033d247c4ecb 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/edit/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/edit/index.tsx @@ -84,7 +84,7 @@ const EditRulePageComponent: FC = () => { needsConfiguration: needsListsConfiguration, } = useListsConfig(); const initLoading = userInfoLoading || listsConfigLoading; - const { detailName: ruleId } = useParams(); + const { detailName: ruleId } = useParams<{ detailName: string | undefined }>(); const [loading, rule] = useRule(ruleId); const [initForm, setInitForm] = useState(false); diff --git a/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx b/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx index 2b19249dc426f..ef88c255b1735 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx @@ -57,7 +57,7 @@ export const HostsComponent = React.memo( const { globalFullScreen } = useFullScreen(); const capabilities = useMlCapabilities(); const kibana = useKibana(); - const { tabName } = useParams(); + const { tabName } = useParams<{ tabName: string }>(); const tabsFilters = React.useMemo(() => { if (tabName === HostsTableType.alerts) { return filters.length > 0 ? [...filters, ...filterHostData] : filterHostData; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx index 4135a4c595d6a..235f150637116 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx @@ -54,7 +54,7 @@ export const PolicyDetails = React.memo(() => { services: { application: { navigateToApp }, }, - } = useKibana(); + } = useKibana<{ application: ApplicationStart }>(); const toasts = useToasts(); const { formatUrl } = useFormatUrl(SecurityPageName.administration); const { state: locationRouteState } = useLocation(); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_list.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_list.tsx index ff9c40675def8..647204a6dbbe9 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_list.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_list.tsx @@ -30,6 +30,7 @@ import { useDispatch } from 'react-redux'; import { useLocation, useHistory } from 'react-router-dom'; import { createStructuredSelector } from 'reselect'; import styled from 'styled-components'; +import { ApplicationStart } from 'src/core/public'; import { CreateStructuredSelector } from '../../../../common/store'; import * as selectors from '../store/policy_list/selectors'; import { usePolicyListSelector } from './policy_hooks'; @@ -122,7 +123,7 @@ const PolicyLink: React.FC<{ name: string; route: string; href: string }> = ({ const selector = (createStructuredSelector as CreateStructuredSelector)(selectors); export const PolicyList = React.memo(() => { - const { services } = useKibana(); + const { services } = useKibana<{ application: ApplicationStart }>(); const toasts = useToasts(); const history = useHistory(); const location = useLocation(); diff --git a/x-pack/plugins/security_solution/public/network/pages/network.tsx b/x-pack/plugins/security_solution/public/network/pages/network.tsx index 601bae89f7a4d..848dc94acff61 100644 --- a/x-pack/plugins/security_solution/public/network/pages/network.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/network.tsx @@ -62,7 +62,7 @@ const NetworkComponent = React.memo( const { to, from, setQuery, isInitializing } = useGlobalTime(); const { globalFullScreen } = useFullScreen(); const kibana = useKibana(); - const { tabName } = useParams(); + const { tabName } = useParams<{ tabName: string }>(); const tabsFilters = useMemo(() => { if (tabName === NetworkRouteType.alerts) { diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts index 55451882d96fa..45bdbd0979276 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts @@ -806,6 +806,7 @@ describe('Timeline', () => { }; // temporary, we will have to decouple DataProvider & DataProvidersAnd // that's bigger a refactor than just fixing a bug + // @ts-expect-error delete andProviderToAdd.and; const update = addTimelineProvider({ id: 'foo', diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/read_notifications.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/read_notifications.test.ts index a46f65da58043..672842bd992ad 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/read_notifications.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/read_notifications.test.ts @@ -41,6 +41,7 @@ describe('read_notifications', () => { }); test('should return null if saved object found by alerts client given id is not alert type', async () => { const result = getNotificationResult(); + // @ts-expect-error delete result.alertTypeId; alertsClient.get.mockResolvedValue(result); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/import_rules_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/import_rules_route.test.ts index f6a903ca9a4ee..81c9387c6f39c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/import_rules_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/import_rules_route.test.ts @@ -233,7 +233,9 @@ describe('import_rules_route', () => { const rulesWithoutRuleIds = ['rule-1', 'rule-2'].map((ruleId) => getImportRulesWithIdSchemaMock(ruleId) ); + // @ts-expect-error delete rulesWithoutRuleIds[0].rule_id; + // @ts-expect-error delete rulesWithoutRuleIds[1].rule_id; const badPayload = buildHapiStream(rulesToNdJsonString(rulesWithoutRuleIds)); const badRequest = getImportRulesRequest(badPayload); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/validate.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/validate.test.ts index d03dd72937b01..06ec22b2f61b4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/validate.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/validate.test.ts @@ -93,6 +93,7 @@ describe('validate', () => { test('it should do an in-validation correctly of a partial alert', () => { const ruleAlert = getResult(); + // @ts-expect-error delete ruleAlert.name; const [validated, errors] = transformValidate(ruleAlert); expect(validated).toEqual(null); @@ -110,6 +111,7 @@ describe('validate', () => { test('it should do an in-validation correctly of a partial alert', () => { const findResult: FindResult = { data: [getResult()], page: 1, perPage: 0, total: 0 }; + // @ts-expect-error delete findResult.page; const [validated, errors] = transformValidateFindAlerts(findResult, []); expect(validated).toEqual(null); @@ -126,6 +128,7 @@ describe('validate', () => { test('it should do an in-validation correctly of a rule id', () => { const ruleAlert = getResult(); + // @ts-expect-error delete ruleAlert.name; const validatedOrError = transformValidateBulkError('rule-1', ruleAlert); const expected: BulkError = { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/read_rules.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/read_rules.test.ts index b17a7358cfa52..c43ff6d203fec 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/read_rules.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/read_rules.test.ts @@ -40,6 +40,7 @@ describe('read_rules', () => { test('should return null if saved object found by alerts client given id is not alert type', async () => { const alertsClient = alertsClientMock.create(); const result = getResult(); + // @ts-expect-error delete result.alertTypeId; alertsClient.get.mockResolvedValue(result); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.test.ts index fe2e0f2d96fd8..ee83c826371bc 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.test.ts @@ -39,6 +39,7 @@ describe('buildBulkBody', () => { throttle: 'no_actions', }); // Timestamp will potentially always be different so remove it for the test + // @ts-expect-error delete fakeSignalSourceHit['@timestamp']; const expected: Omit & { someKey: 'someValue' } = { someKey: 'someValue', @@ -132,6 +133,7 @@ describe('buildBulkBody', () => { throttle: 'no_actions', }); // Timestamp will potentially always be different so remove it for the test + // @ts-expect-error delete fakeSignalSourceHit['@timestamp']; const expected: Omit & { someKey: 'someValue' } = { someKey: 'someValue', @@ -233,6 +235,7 @@ describe('buildBulkBody', () => { throttle: 'no_actions', }); // Timestamp will potentially always be different so remove it for the test + // @ts-expect-error delete fakeSignalSourceHit['@timestamp']; const expected: Omit & { someKey: 'someValue' } = { someKey: 'someValue', @@ -331,6 +334,7 @@ describe('buildBulkBody', () => { throttle: 'no_actions', }); // Timestamp will potentially always be different so remove it for the test + // @ts-expect-error delete fakeSignalSourceHit['@timestamp']; const expected: Omit & { someKey: 'someValue' } = { someKey: 'someValue', diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/tags/read_tags.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/tags/read_tags.test.ts index d07fa382e114a..5c5d8605d7811 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/tags/read_tags.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/tags/read_tags.test.ts @@ -287,6 +287,7 @@ describe('read_tags', () => { const result2 = getResult(); result2.id = '99979e67-19a7-455f-b452-8eded6135716'; result2.params.ruleId = 'rule-2'; + // @ts-expect-error delete result2.tags; const result3 = getResult(); diff --git a/x-pack/plugins/security_solution/server/lib/events/elasticsearch_adapter.ts b/x-pack/plugins/security_solution/server/lib/events/elasticsearch_adapter.ts index aabb18d419098..dda52e26ca42b 100644 --- a/x-pack/plugins/security_solution/server/lib/events/elasticsearch_adapter.ts +++ b/x-pack/plugins/security_solution/server/lib/events/elasticsearch_adapter.ts @@ -51,12 +51,11 @@ export class ElasticsearchEventsAdapter implements EventsAdapter { request: FrameworkRequest, options: TimelineRequestOptions ): Promise { - const queryOptions = cloneDeep(options); + const { fieldRequested, ...queryOptions } = cloneDeep(options); queryOptions.fields = uniq([ - ...queryOptions.fieldRequested, + ...fieldRequested, ...reduceFields(queryOptions.fields, eventFieldsMap), ]); - delete queryOptions.fieldRequested; const dsl = buildTimelineQuery(queryOptions); const response = await this.framework.callWithRequest( request, diff --git a/x-pack/plugins/security_solution/server/lib/events/mock.ts b/x-pack/plugins/security_solution/server/lib/events/mock.ts index f5fb2f481ca77..a3350a08c7d34 100644 --- a/x-pack/plugins/security_solution/server/lib/events/mock.ts +++ b/x-pack/plugins/security_solution/server/lib/events/mock.ts @@ -2875,6 +2875,7 @@ export const mockQueryDsl = { }; const mockTimelineDetailsInspectResponse = cloneDeep(mockResponseSearchTimelineDetails); +// @ts-expect-error delete mockTimelineDetailsInspectResponse.hits.hits[0]._source; export const mockTimelineDetailsResult = { diff --git a/x-pack/plugins/transform/public/app/common/pivot_group_by.ts b/x-pack/plugins/transform/public/app/common/pivot_group_by.ts index bd5a5a26d9019..7da52fc018338 100644 --- a/x-pack/plugins/transform/public/app/common/pivot_group_by.ts +++ b/x-pack/plugins/transform/public/app/common/pivot_group_by.ts @@ -132,13 +132,9 @@ export type PivotGroupBy = GenericAgg | TermsAgg | HistogramAgg | DateHistogramA export type PivotGroupByDict = Dictionary; export function getEsAggFromGroupByConfig(groupByConfig: GroupByConfigBase): GenericAgg { - const esAgg = { ...groupByConfig }; - - delete esAgg.agg; - delete esAgg.aggName; - delete esAgg.dropDownName; + const { agg, aggName, dropDownName, ...esAgg } = groupByConfig; return { - [groupByConfig.agg]: esAgg, + [agg]: esAgg, }; } diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx index 311aed19e0706..15efa46dfb891 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx @@ -7,7 +7,7 @@ import React, { FC } from 'react'; import { EuiTabbedContent } from '@elastic/eui'; - +import { Optional } from '@kbn/utility-types'; import { i18n } from '@kbn/i18n'; import moment from 'moment-timezone'; @@ -35,8 +35,10 @@ interface Props { item: TransformListRow; } +type StateValues = Optional; + export const ExpandedRow: FC = ({ item }) => { - const stateValues = { ...item.stats }; + const stateValues: StateValues = { ...item.stats }; delete stateValues.stats; delete stateValues.checkpointing; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/app.tsx b/x-pack/plugins/triggers_actions_ui/public/application/app.tsx index 1f9352d8405d2..c53dc0c105084 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/app.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/app.tsx @@ -26,8 +26,8 @@ import { PluginStartContract as AlertingStart } from '../../../alerts/public'; import { suspendedComponentWithProps } from './lib/suspended_component_with_props'; const TriggersActionsUIHome = lazy(async () => import('./home')); -const AlertDetailsRoute = lazy(() => - import('./sections/alert_details/components/alert_details_route') +const AlertDetailsRoute = lazy( + () => import('./sections/alert_details/components/alert_details_route') ); export interface AppDeps { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/context/alerts_context.tsx b/x-pack/plugins/triggers_actions_ui/public/application/context/alerts_context.tsx index 95620a5be8474..953a444500084 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/context/alerts_context.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/context/alerts_context.tsx @@ -8,7 +8,7 @@ import React, { useContext, createContext } from 'react'; import { HttpSetup, IUiSettingsClient, - ToastsApi, + ToastsStart, DocLinksStart, ApplicationStart, } from 'kibana/public'; @@ -22,10 +22,7 @@ export interface AlertsContextValue> { http: HttpSetup; alertTypeRegistry: TypeRegistry; actionTypeRegistry: TypeRegistry; - toastNotifications: Pick< - ToastsApi, - 'get$' | 'add' | 'remove' | 'addSuccess' | 'addWarning' | 'addDanger' | 'addError' - >; + toastNotifications: ToastsStart; uiSettings?: IUiSettingsClient; charts?: ChartsPluginSetup; docLinks: DocLinksStart; diff --git a/x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/action_factory_definition.ts b/x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/action_factory_definition.ts index 0acd3ea3e51a7..d79614e47ccd4 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/action_factory_definition.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/action_factory_definition.ts @@ -24,8 +24,7 @@ export interface ActionFactoryDefinition< triggers: SupportedTriggers[]; }, ActionContext extends TriggerContextMapping[SupportedTriggers] = TriggerContextMapping[SupportedTriggers] -> - extends Partial, 'getHref'>>, +> extends Partial, 'getHref'>>, Configurable { /** * Unique ID of the action factory. This ID is used to identify this action diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/uptime_alerts_context_provider.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/uptime_alerts_context_provider.tsx index d1c6f076d6749..e59c55210c179 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/uptime_alerts_context_provider.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/uptime_alerts_context_provider.tsx @@ -5,9 +5,33 @@ */ import React from 'react'; -import { AlertsContextProvider } from '../../../../../../plugins/triggers_actions_ui/public'; +import { + HttpStart, + NotificationsStart, + IUiSettingsClient, + DocLinksStart, + ApplicationStart, +} from 'src/core/public'; +import { DataPublicPluginStart } from '../../../../../../../src/plugins/data/public'; +import { ChartsPluginStart } from '../../../../../../../src/plugins/charts/public'; +import { + AlertsContextProvider, + TriggersAndActionsUIPublicPluginStart, +} from '../../../../../../plugins/triggers_actions_ui/public'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +interface KibanaDeps { + http: HttpStart; + notifications: NotificationsStart; + uiSettings: IUiSettingsClient; + docLinks: DocLinksStart; + application: ApplicationStart; + + data: DataPublicPluginStart; + charts: ChartsPluginStart; + triggers_actions_ui: TriggersAndActionsUIPublicPluginStart; +} + export const UptimeAlertsContextProvider: React.FC = ({ children }) => { const { services: { @@ -20,7 +44,7 @@ export const UptimeAlertsContextProvider: React.FC = ({ children }) => { docLinks, application: { capabilities }, }, - } = useKibana(); + } = useKibana(); return ( (); const [state, setState] = useState({ suggestions: [], @@ -102,8 +103,8 @@ export function KueryBar({ language: 'kuery', indexPatterns: [indexPattern], query: inputValue, - selectionStart, - selectionEnd: selectionStart, + selectionStart: selectionStart || 0, + selectionEnd: selectionStart || 0, boolFilter: [ { range: { diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_list_drawer.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_list_drawer.test.tsx index 302137199276b..4e8ffc64cfe92 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_list_drawer.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_list_drawer.test.tsx @@ -62,6 +62,7 @@ describe('MonitorListDrawer component', () => { }); it('renders nothing when no check data is present', () => { + // @ts-expect-error According to the code, the property is optional delete summary.state.summaryPings; const component = shallowWithRouter( void; } +interface KibanaDeps { + triggers_actions_ui: TriggersAndActionsUIPublicPluginStart; + application: ApplicationStart; + docLinks: DocLinksStart; + http: HttpStart; + notifications: NotificationsStart; +} + export const AddConnectorFlyout = ({ focusInput }: Props) => { const [addFlyoutVisible, setAddFlyoutVisibility] = useState(false); @@ -30,7 +39,7 @@ export const AddConnectorFlyout = ({ focusInput }: Props) => { http, notifications, }, - } = useKibana(); + } = useKibana(); const dispatch = useDispatch(); diff --git a/x-pack/plugins/uptime/public/components/settings/alert_defaults_form.tsx b/x-pack/plugins/uptime/public/components/settings/alert_defaults_form.tsx index b3b38a84e4f22..7636d4ede4bab 100644 --- a/x-pack/plugins/uptime/public/components/settings/alert_defaults_form.tsx +++ b/x-pack/plugins/uptime/public/components/settings/alert_defaults_form.tsx @@ -24,9 +24,14 @@ import { useGetUrlParams, useUrlParams } from '../../hooks'; import { alertFormI18n } from './translations'; import { useInitApp } from '../../hooks/use_init_app'; import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; +import { TriggersAndActionsUIPublicPluginStart } from '../../../../triggers_actions_ui/public/'; type ConnectorOption = EuiComboBoxOptionOption; +interface KibanaDeps { + triggers_actions_ui: TriggersAndActionsUIPublicPluginStart; +} + const ConnectorSpan = styled.span` .euiIcon { margin-right: 5px; @@ -48,7 +53,7 @@ export const AlertDefaultsForm: React.FC = ({ services: { triggers_actions_ui: { actionTypeRegistry }, }, - } = useKibana(); + } = useKibana(); const { focusConnectorField } = useGetUrlParams(); const updateUrlParams = useUrlParams()[1]; diff --git a/x-pack/plugins/uptime/public/hooks/use_monitor.ts b/x-pack/plugins/uptime/public/hooks/use_monitor.ts index 8080ce2696a3c..000e497b29cff 100644 --- a/x-pack/plugins/uptime/public/hooks/use_monitor.ts +++ b/x-pack/plugins/uptime/public/hooks/use_monitor.ts @@ -7,7 +7,7 @@ import { useParams } from 'react-router-dom'; export const useMonitorId = (): string => { - const { monitorId } = useParams(); + const { monitorId } = useParams<{ monitorId: string }>(); // decode 64 base string, it was decoded to make it a valid url, since monitor id can be a url return atob(monitorId || ''); diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_infra_href.test.ts b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_infra_href.test.ts index befa11d74df4a..b1247ad5b8935 100644 --- a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_infra_href.test.ts +++ b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_infra_href.test.ts @@ -79,6 +79,7 @@ describe('getInfraHref', () => { }); it('getInfraContainerHref returns undefined when summaryPings are undefined', () => { + // @ts-expect-error delete summary.state.summaryPings; expect(getInfraContainerHref(summary, '')).toBeUndefined(); }); @@ -125,6 +126,7 @@ describe('getInfraHref', () => { }); it('getInfraKubernetesHref returns undefined when summaryPings are undefined', () => { + // @ts-expect-error delete summary.state.summaryPings; expect(getInfraKubernetesHref(summary, '')).toBeUndefined(); }); @@ -183,6 +185,7 @@ describe('getInfraHref', () => { }); it('getInfraIpHref returns undefined if summaryPings are undefined', () => { + // @ts-expect-error delete summary.state.summaryPings; expect(getInfraIpHref(summary, 'foo')).toBeUndefined(); }); diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_logging_href.test.ts b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_logging_href.test.ts index 203d5b84c433a..d2a7a96a8b6f9 100644 --- a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_logging_href.test.ts +++ b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_logging_href.test.ts @@ -93,6 +93,7 @@ describe('getLoggingHref', () => { }); it('returns undefined if necessary container is not present', () => { + // @ts-expect-error According to the code, the property is optional delete summary.state.summaryPings; expect(getLoggingContainerHref(summary, '')).toBeUndefined(); }); @@ -103,6 +104,7 @@ describe('getLoggingHref', () => { }); it('returns undefined if necessary pod is not present', () => { + // @ts-expect-error According to the code, the property is optional delete summary.state.summaryPings; expect(getLoggingKubernetesHref(summary, '')).toBeUndefined(); }); @@ -113,6 +115,7 @@ describe('getLoggingHref', () => { }); it('returns undefined ip href if ip is not present', () => { + // @ts-expect-error According to the code, the property is optional delete summary.state.summaryPings; expect(getLoggingIpHref(summary, '')).toBeUndefined(); }); diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/aad/package.json b/x-pack/test/alerting_api_integration/common/fixtures/plugins/aad/package.json index 50016592ba1ac..fbc4d8d92203a 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/aad/package.json +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/aad/package.json @@ -11,7 +11,7 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" }, "license": "Apache-2.0", "dependencies": { diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/actions_simulators/package.json b/x-pack/test/alerting_api_integration/common/fixtures/plugins/actions_simulators/package.json index 84e4783072f31..20afe49fc1f19 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/actions_simulators/package.json +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/actions_simulators/package.json @@ -11,7 +11,7 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" }, "license": "Apache-2.0", "dependencies": { diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/package.json b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/package.json index 7796538997de1..41147ab62d359 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/package.json +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/package.json @@ -11,7 +11,7 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" }, "license": "Apache-2.0", "dependencies": { diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts_restricted/package.json b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts_restricted/package.json index fe3b905106ee0..8d7010879b7d7 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts_restricted/package.json +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts_restricted/package.json @@ -11,7 +11,7 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.7.2" + "typescript": "4.0.2" }, "license": "Apache-2.0", "dependencies": { diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/task_manager_fixture/package.json b/x-pack/test/alerting_api_integration/common/fixtures/plugins/task_manager_fixture/package.json index 5b486da23c9e4..8b8532af6eecf 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/task_manager_fixture/package.json +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/task_manager_fixture/package.json @@ -11,7 +11,7 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" }, "license": "Apache-2.0", "dependencies": { diff --git a/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts b/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts index a68f8de39d48e..a9e5d0c832c8c 100644 --- a/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts +++ b/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts @@ -214,10 +214,10 @@ export class AlertUtils { .set('kbn-xsrf', 'foo') .auth(user.username, user.password); - const alertBody = getDefaultAlwaysFiringAlertData(reference, actionId); - delete alertBody.alertTypeId; - delete alertBody.enabled; - delete alertBody.consumer; + const { alertTypeId, enabled, consumer, ...alertBody } = getDefaultAlwaysFiringAlertData( + reference, + actionId + ); const response = await request.send({ ...alertBody, ...overwrites }); return response; diff --git a/x-pack/test/functional_embedded/plugins/iframe_embedded/package.json b/x-pack/test/functional_embedded/plugins/iframe_embedded/package.json index 9fa1554e5312b..c74aa683d6f32 100644 --- a/x-pack/test/functional_embedded/plugins/iframe_embedded/package.json +++ b/x-pack/test/functional_embedded/plugins/iframe_embedded/package.json @@ -9,6 +9,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/package.json b/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/package.json index 289017d37d634..f8bafad602269 100644 --- a/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/package.json +++ b/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/package.json @@ -10,6 +10,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/x-pack/test/functional_with_es_ssl/services/alerting/actions.ts b/x-pack/test/functional_with_es_ssl/services/alerting/actions.ts index cff5b3c3ce9c3..060c4f13e70c7 100644 --- a/x-pack/test/functional_with_es_ssl/services/alerting/actions.ts +++ b/x-pack/test/functional_with_es_ssl/services/alerting/actions.ts @@ -30,10 +30,11 @@ export class Actions { }) { this.log.debug(`creating action ${actionParams.name}`); - const { data: action, status: actionStatus, actionStatusText } = await this.axios.post( - `/api/actions/action`, - actionParams - ); + const { + data: action, + status: actionStatus, + statusText: actionStatusText, + } = await this.axios.post(`/api/actions/action`, actionParams); if (actionStatus !== 200) { throw new Error( `Expected status code of 200, received ${actionStatus} ${actionStatusText}: ${util.inspect( diff --git a/x-pack/test/plugin_api_integration/plugins/elasticsearch_client/package.json b/x-pack/test/plugin_api_integration/plugins/elasticsearch_client/package.json index ed31989472134..c12de16b9b4af 100644 --- a/x-pack/test/plugin_api_integration/plugins/elasticsearch_client/package.json +++ b/x-pack/test/plugin_api_integration/plugins/elasticsearch_client/package.json @@ -9,6 +9,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/x-pack/test/plugin_api_integration/plugins/event_log/package.json b/x-pack/test/plugin_api_integration/plugins/event_log/package.json index 92c5fb5f36cfc..03bef5b8272ba 100644 --- a/x-pack/test/plugin_api_integration/plugins/event_log/package.json +++ b/x-pack/test/plugin_api_integration/plugins/event_log/package.json @@ -10,6 +10,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" } } diff --git a/x-pack/test/plugin_api_integration/plugins/sample_task_plugin/package.json b/x-pack/test/plugin_api_integration/plugins/sample_task_plugin/package.json index f8de67e9c6974..513443486ad8e 100644 --- a/x-pack/test/plugin_api_integration/plugins/sample_task_plugin/package.json +++ b/x-pack/test/plugin_api_integration/plugins/sample_task_plugin/package.json @@ -11,7 +11,7 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" }, "license": "Apache-2.0", "dependencies": {} diff --git a/x-pack/test/plugin_api_perf/plugins/task_manager_performance/package.json b/x-pack/test/plugin_api_perf/plugins/task_manager_performance/package.json index 2b174a8cae076..542c8358114f4 100644 --- a/x-pack/test/plugin_api_perf/plugins/task_manager_performance/package.json +++ b/x-pack/test/plugin_api_perf/plugins/task_manager_performance/package.json @@ -16,7 +16,7 @@ "pretty-ms": "5.0.0" }, "devDependencies": { - "typescript": "3.9.5" + "typescript": "4.0.2" }, "license": "Apache-2.0" } diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/csv_saved_search.ts b/x-pack/test/reporting_api_integration/reporting_and_security/csv_saved_search.ts index 7c08f377c9b15..9a7d17c971dfe 100644 --- a/x-pack/test/reporting_api_integration/reporting_and_security/csv_saved_search.ts +++ b/x-pack/test/reporting_api_integration/reporting_and_security/csv_saved_search.ts @@ -293,7 +293,7 @@ export default function ({ getService }: FtrProviderContext) { searchId: 'search:a6d51430-ace2-11ea-815f-39e12f89a8c2', postPayload: { timerange: { timezone: 'UTC', min: '1979-01-01T10:00:00Z', max: '1981-01-01T10:00:00Z' }, // prettier-ignore - state: { query: { bool: { filter: [ { bool: { filter: [ { bool: { minimum_should_match: 1, should: [{ query_string: { fields: ['name'], query: 'Fel*' } }] } } ] } } ] } } } // prettier-ignore + state: { query: { bool: { filter: [ { bool: { filter: [ { bool: { minimum_should_match: 1, should: [{ query_string: { fields: ['name'], query: 'Fel*' } }] } } ] } } ] } } }, // prettier-ignore }, isImmediate: true, }; diff --git a/yarn.lock b/yarn.lock index 845685ff36f7d..d3994337301cf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4999,26 +4999,26 @@ resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d" integrity sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg== -"@typescript-eslint/eslint-plugin@^3.7.1": - version "3.7.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.7.1.tgz#d144c49a9a0ffe8dd704bb179c243df76c111bc9" - integrity sha512-3DB9JDYkMrc8Au00rGFiJLK2Ja9CoMP6Ut0sHsXp3ZtSugjNxvSSHTnKLfo4o+QmjYBJqEznDqsG1zj4F2xnsg== +"@typescript-eslint/eslint-plugin@^3.10.0": + version "3.10.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.0.tgz#40fd53e81639c0d1a515b44e5fdf4c03dfd3cd39" + integrity sha512-Bbeg9JAnSzZ85Y0gpInZscSpifA6SbEgRryaKdP5ZlUjhTKsvZS4GUIE6xAZCjhNTrf4zXXsySo83ZdHL7it0w== dependencies: - "@typescript-eslint/experimental-utils" "3.7.1" + "@typescript-eslint/experimental-utils" "3.10.0" debug "^4.1.1" functional-red-black-tree "^1.0.1" regexpp "^3.0.0" semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@3.7.1": - version "3.7.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.7.1.tgz#ab036caaed4c870d22531d41f9352f3147364d61" - integrity sha512-TqE97pv7HrqWcGJbLbZt1v59tcqsSVpWTOf1AqrWK7n8nok2sGgVtYRuGXeNeLw3wXlLEbY1MKP3saB2HsO/Ng== +"@typescript-eslint/experimental-utils@3.10.0": + version "3.10.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.0.tgz#f97a669a84a78319ab324cd51169d0c52853a360" + integrity sha512-e5ZLSTuXgqC/Gq3QzK2orjlhTZVXzwxDujQmTBOM1NIVBZgW3wiIZjaXuVutk9R4UltFlwC9UD2+bdxsA7yyNg== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/types" "3.7.1" - "@typescript-eslint/typescript-estree" "3.7.1" + "@typescript-eslint/types" "3.10.0" + "@typescript-eslint/typescript-estree" "3.10.0" eslint-scope "^5.0.0" eslint-utils "^2.0.0" @@ -5031,21 +5031,21 @@ "@typescript-eslint/typescript-estree" "2.15.0" eslint-scope "^5.0.0" -"@typescript-eslint/parser@^3.7.1": - version "3.7.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.7.1.tgz#5d9ccecb116d12d9c6073e9861c57c9b1aa88128" - integrity sha512-W4QV/gXvfIsccN8225784LNOorcm7ch68Fi3V4Wg7gmkWSQRKevO4RrRqWo6N/Z/myK1QAiGgeaXN57m+R/8iQ== +"@typescript-eslint/parser@^3.10.0": + version "3.10.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.10.0.tgz#820322d990a82265a78f4c1fc9aae03ce95b76ac" + integrity sha512-iJyf3f2HVwscvJR7ySGMXw2DJgIAPKEz8TeU17XVKzgJRV4/VgCeDFcqLzueRe7iFI2gv+Tln4AV88ZOnsCNXg== dependencies: "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "3.7.1" - "@typescript-eslint/types" "3.7.1" - "@typescript-eslint/typescript-estree" "3.7.1" + "@typescript-eslint/experimental-utils" "3.10.0" + "@typescript-eslint/types" "3.10.0" + "@typescript-eslint/typescript-estree" "3.10.0" eslint-visitor-keys "^1.1.0" -"@typescript-eslint/types@3.7.1": - version "3.7.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.7.1.tgz#90375606b2fd73c1224fe9e397ee151e28fa1e0c" - integrity sha512-PZe8twm5Z4b61jt7GAQDor6KiMhgPgf4XmUb9zdrwTbgtC/Sj29gXP1dws9yEn4+aJeyXrjsD9XN7AWFhmnUfg== +"@typescript-eslint/types@3.10.0": + version "3.10.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.10.0.tgz#b81906674eca94a884345ba0bc1aaf6cd4da912a" + integrity sha512-ktUWSa75heQNwH85GRM7qP/UUrXqx9d6yIdw0iLO9/uE1LILW+i+3+B64dUodUS2WFWLzKTlwfi9giqrODibWg== "@typescript-eslint/typescript-estree@2.15.0": version "2.15.0" @@ -5060,13 +5060,13 @@ semver "^6.3.0" tsutils "^3.17.1" -"@typescript-eslint/typescript-estree@3.7.1": - version "3.7.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.7.1.tgz#ce1ffbd0fa53f34d4ce851a7a364e392432f6eb3" - integrity sha512-m97vNZkI08dunYOr2lVZOHoyfpqRs0KDpd6qkGaIcLGhQ2WPtgHOd/eVbsJZ0VYCQvupKrObAGTOvk3tfpybYA== +"@typescript-eslint/typescript-estree@3.10.0": + version "3.10.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.0.tgz#65df13579a5e53c12afb4f1c5309589e3855a5de" + integrity sha512-yjuY6rmVHRhcUKgXaSPNVloRueGWpFNhxR5EQLzxXfiFSl1U/+FBqHhbaGwtPPEgCSt61QNhZgiFjWT27bgAyw== dependencies: - "@typescript-eslint/types" "3.7.1" - "@typescript-eslint/visitor-keys" "3.7.1" + "@typescript-eslint/types" "3.10.0" + "@typescript-eslint/visitor-keys" "3.10.0" debug "^4.1.1" glob "^7.1.6" is-glob "^4.0.1" @@ -5082,10 +5082,10 @@ lodash.unescape "4.0.1" semver "5.5.0" -"@typescript-eslint/visitor-keys@3.7.1": - version "3.7.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.7.1.tgz#b90191e74efdee656be8c5a30f428ed16dda46d1" - integrity sha512-xn22sQbEya+Utj2IqJHGLA3i1jDzR43RzWupxojbSWnj3nnPLavaQmWe5utw03CwYao3r00qzXfgJMGNkrzrAA== +"@typescript-eslint/visitor-keys@3.10.0": + version "3.10.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.0.tgz#6c0cac867e705a42e2c71b359bf6a10a88a28985" + integrity sha512-g4qftk8lWb/rHZe9uEp8oZSvsJhUvR2cfp7F7qE6DyUD2SsovEs8JDQTRP1xHzsD+pERsEpYNqkDgQXW6+ob5A== dependencies: eslint-visitor-keys "^1.1.0" @@ -11979,10 +11979,10 @@ eslint-plugin-prefer-object-spread@^1.2.1: resolved "https://registry.yarnpkg.com/eslint-plugin-prefer-object-spread/-/eslint-plugin-prefer-object-spread-1.2.1.tgz#27fb91853690cceb3ae6101d9c8aecc6a67a402c" integrity sha1-J/uRhTaQzOs65hAdnIrsxqZ6QCw= -eslint-plugin-prettier@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.3.tgz#ae116a0fc0e598fdae48743a4430903de5b4e6ca" - integrity sha512-+HG5jmu/dN3ZV3T6eCD7a4BlAySdN7mLIbJYo0z1cFQuI+r2DiTJEFeF68ots93PsnrMxbzIZ2S/ieX+mkrBeQ== +eslint-plugin-prettier@^3.1.4: + version "3.1.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2" + integrity sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg== dependencies: prettier-linter-helpers "^1.0.0" @@ -22451,10 +22451,10 @@ prettier@1.16.4: resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717" integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g== -prettier@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" - integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== +prettier@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.1.tgz#d9485dd5e499daa6cb547023b87a6cf51bee37d6" + integrity sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw== pretty-bytes@5.3.0: version "5.3.0" @@ -28143,10 +28143,10 @@ typescript-tuple@^2.2.1: dependencies: typescript-compare "^0.0.2" -typescript@3.9.5, typescript@^3.0.1, typescript@^3.0.3, typescript@^3.2.2, typescript@^3.3.3333, typescript@^3.4.5, typescript@~3.7.2: - version "3.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" - integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== +typescript@4.0.2, typescript@^3.0.1, typescript@^3.0.3, typescript@^3.2.2, typescript@^3.3.3333, typescript@^3.4.5, typescript@~3.7.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2" + integrity sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ== typings-tester@^0.3.2: version "0.3.2"