From bd6b5521ea0e8380e1072733d3c2b1e8d567e556 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 28 Jul 2023 18:45:42 +0100 Subject: [PATCH 01/25] chore(NA): upgrade typescript into v4.7.4 --- package.json | 4 ++-- packages/kbn-repo-packages/modern/plugins.js | 6 +----- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index d9506aac45273..f9a88a47f99b8 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "**/hoist-non-react-statics": "^3.3.2", "**/isomorphic-fetch/node-fetch": "^2.6.7", "**/remark-parse/trim": "1.0.1", - "**/typescript": "4.6.3", + "**/typescript": "4.7.4", "globby/fast-glob": "^3.2.11" }, "dependencies": { @@ -1542,7 +1542,7 @@ "tree-kill": "^1.2.2", "ts-morph": "^13.0.2", "tsd": "^0.20.0", - "typescript": "4.6.3", + "typescript": "4.7.4", "url-loader": "^2.2.0", "val-loader": "^1.1.1", "vinyl-fs": "^4.0.0", diff --git a/packages/kbn-repo-packages/modern/plugins.js b/packages/kbn-repo-packages/modern/plugins.js index a197c6a679771..31dd08bf1f5ba 100644 --- a/packages/kbn-repo-packages/modern/plugins.js +++ b/packages/kbn-repo-packages/modern/plugins.js @@ -107,11 +107,7 @@ function getPluginPackagesFilter(selector = {}) { */ function getDistributablePacakgesFilter() { return (pkg) => { - if ( - pkg.isDevOnly || - pkg.manifest.type === 'functional-tests' || - pkg.manifest.type === 'test-helper' - ) { + if (pkg.isDevOnly()) { return false; } diff --git a/yarn.lock b/yarn.lock index 20d78765516d2..8f8206b3ed90c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28362,10 +28362,10 @@ typescript-tuple@^2.2.1: dependencies: typescript-compare "^0.0.2" -typescript@4.6.3, typescript@^3.3.3333, typescript@^4.6.3, typescript@^4.8.4: - version "4.6.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.3.tgz#eefeafa6afdd31d725584c67a0eaba80f6fc6c6c" - integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw== +typescript@4.7.4, typescript@^3.3.3333, typescript@^4.6.3, typescript@^4.8.4: + version "4.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" + integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== typewise-core@^1.2, typewise-core@^1.2.0: version "1.2.0" From 23ce0f5ecfd48e76f848b501182912f9ac66ae0d Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 28 Jul 2023 19:08:18 +0100 Subject: [PATCH 02/25] fix(NA): include some type failures fixes --- .../core-http-router-server-internal/src/request.ts | 1 + .../src/versioned_router/core_versioned_route.ts | 12 ++++++------ .../expressions/common/execution/execution.ts | 4 ++++ .../expression_function_parameter.ts | 4 ++-- .../server/alert_data_client/browser_fields/index.ts | 1 + .../security/server/authentication/authenticator.ts | 4 ++-- .../server/session_management/session_index.ts | 1 + 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/packages/core/http/core-http-router-server-internal/src/request.ts b/packages/core/http/core-http-router-server-internal/src/request.ts index 8c31635feb8c2..38c387585b262 100644 --- a/packages/core/http/core-http-router-server-internal/src/request.ts +++ b/packages/core/http/core-http-router-server-internal/src/request.ts @@ -116,6 +116,7 @@ export class CoreKibanaRequest< public readonly rewrittenUrl?: URL; /** @internal */ + // @ts-expect-error property is assigned with defineProperty in the constructor protected readonly [requestSymbol]: Request; constructor( diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts index dd1a0c21d5593..1c972b346c353 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts @@ -161,9 +161,9 @@ export class CoreVersionedRoute implements VersionedRoute { ) { try { const { body, params, query } = validate(req, validation.request, handler.options.version); - req.body = body; - req.params = params; - req.query = query; + (req as Mutable).body = body; + (req as Mutable).params = params; + (req as Mutable).query = query; } catch (e) { return res.badRequest({ body: e.message, @@ -171,9 +171,9 @@ export class CoreVersionedRoute implements VersionedRoute { } } else { // Preserve behavior of not passing through unvalidated data - req.body = {}; - req.params = {}; - req.query = {}; + (req as Mutable).body = {}; + (req as Mutable).params = {}; + (req as Mutable).query = {}; } const response = await handler.fn(ctx, req, res); diff --git a/src/plugins/expressions/common/execution/execution.ts b/src/plugins/expressions/common/execution/execution.ts index d8932f234e39a..1e010be4e9557 100644 --- a/src/plugins/expressions/common/execution/execution.ts +++ b/src/plugins/expressions/common/execution/execution.ts @@ -420,10 +420,12 @@ export class Execution< : of(resolvedArgs); return args$.pipe( + // @ts-expect-error upgrade to ts v4.7.4 tap((args) => this.execution.params.debug && Object.assign(head.debug, { args })), switchMap((args) => this.invokeFunction(fn, input, args)), this.execution.params.partial ? identity : last(), switchMap((output) => (getType(output) === 'error' ? throwError(output) : of(output))), + // @ts-expect-error upgrade to ts v4.7.4 tap((output) => this.execution.params.debug && Object.assign(head.debug, { output })), switchMap((output) => this.invokeChain(tail, output)), catchError((rawError) => { @@ -431,6 +433,7 @@ export class Execution< error.error.message = `[${fnName}] > ${error.error.message}`; if (this.execution.params.debug) { + // @ts-expect-error upgrade to ts v4.7.4 Object.assign(head.debug, { error, rawError, success: false }); } @@ -440,6 +443,7 @@ export class Execution< }), finalize(() => { if (this.execution.params.debug) { + // @ts-expect-error upgrade to ts v4.7.4 Object.assign(head.debug, { duration: now() - timeStart }); } }) diff --git a/src/plugins/expressions/common/expression_functions/expression_function_parameter.ts b/src/plugins/expressions/common/expression_functions/expression_function_parameter.ts index 530d0bc5a9c5c..644eb4bb8005e 100644 --- a/src/plugins/expressions/common/expression_functions/expression_function_parameter.ts +++ b/src/plugins/expressions/common/expression_functions/expression_function_parameter.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { KnownTypeToString } from '../types'; +import { TypeString } from '../types'; import { ArgumentType } from './arguments'; export class ExpressionFunctionParameter { @@ -46,6 +46,6 @@ export class ExpressionFunctionParameter { } accepts(type: string) { - return !this.types?.length || this.types.includes(type as KnownTypeToString); + return !this.types?.length || this.types.includes(type as TypeString); } } diff --git a/x-pack/plugins/rule_registry/server/alert_data_client/browser_fields/index.ts b/x-pack/plugins/rule_registry/server/alert_data_client/browser_fields/index.ts index f7ba028e5917b..bbb91309b4fca 100644 --- a/x-pack/plugins/rule_registry/server/alert_data_client/browser_fields/index.ts +++ b/x-pack/plugins/rule_registry/server/alert_data_client/browser_fields/index.ts @@ -36,6 +36,7 @@ export const fieldDescriptorToBrowserFieldMapper = (fields: FieldDescriptor[]): const browserField = browserFieldFactory(field, category); if (browserFields[category] && browserFields[category]) { + // @ts-expect-error ts upgrade to v4.7.4 Object.assign(browserFields[category].fields, browserField); } else { browserFields[category] = { fields: browserField }; diff --git a/x-pack/plugins/security/server/authentication/authenticator.ts b/x-pack/plugins/security/server/authentication/authenticator.ts index 8599eb287989e..5811168274e4a 100644 --- a/x-pack/plugins/security/server/authentication/authenticator.ts +++ b/x-pack/plugins/security/server/authentication/authenticator.ts @@ -259,7 +259,7 @@ export class Authenticator { ...providerCommonOptions, name, logger: options.loggers.get(type, name), - urls: { loggedOut: (request) => this.getLoggedOutURL(request, type) }, + urls: { loggedOut: (request: any) => this.getLoggedOutURL(request, type) }, }), this.options.config.authc.providers[type]?.[name] ), @@ -275,7 +275,7 @@ export class Authenticator { name: '__http__', logger: options.loggers.get(HTTPAuthenticationProvider.type), urls: { - loggedOut: (request) => this.getLoggedOutURL(request, HTTPAuthenticationProvider.type), + loggedOut: (request: any) => this.getLoggedOutURL(request, HTTPAuthenticationProvider.type), }, }) ); diff --git a/x-pack/plugins/security/server/session_management/session_index.ts b/x-pack/plugins/security/server/session_management/session_index.ts index cc3307d37adf1..62c573f5cbd74 100644 --- a/x-pack/plugins/security/server/session_management/session_index.ts +++ b/x-pack/plugins/security/server/session_management/session_index.ts @@ -90,6 +90,7 @@ export function getSessionIndexSettings({ indexName: string; aliasName: string; }): IndicesCreateRequest { + // @ts-expect-error ts upgrade to v4.7.4 return Object.freeze({ index: indexName, settings: { From 1646204ff87a1c09c1e4ec43d0ca661c28ed0b17 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 28 Jul 2023 18:14:32 +0000 Subject: [PATCH 03/25] [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' --- x-pack/plugins/security/server/authentication/authenticator.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security/server/authentication/authenticator.ts b/x-pack/plugins/security/server/authentication/authenticator.ts index 5811168274e4a..1f6c101a16b5a 100644 --- a/x-pack/plugins/security/server/authentication/authenticator.ts +++ b/x-pack/plugins/security/server/authentication/authenticator.ts @@ -275,7 +275,8 @@ export class Authenticator { name: '__http__', logger: options.loggers.get(HTTPAuthenticationProvider.type), urls: { - loggedOut: (request: any) => this.getLoggedOutURL(request, HTTPAuthenticationProvider.type), + loggedOut: (request: any) => + this.getLoggedOutURL(request, HTTPAuthenticationProvider.type), }, }) ); From 2476853f95e89235ca47cb80f158955e322b7a12 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 28 Jul 2023 20:45:39 +0100 Subject: [PATCH 04/25] chore(NA): process more typescript errors --- .../components/doc_table/components/table_row.tsx | 1 + .../public/editor/components/labels_panel.tsx | 2 ++ .../options/metrics_axes/label_options.tsx | 2 ++ .../workpad_interactive_page/event_handlers.ts | 2 ++ .../cases/public/components/create/form.test.tsx | 1 + .../editable_markdown_renderer.test.tsx | 1 + x-pack/plugins/fleet/common/experimental_features.ts | 1 + .../agent_policy_advanced_fields/index.test.tsx | 1 + .../sections/agent_policy/list_page/index.test.tsx | 1 + .../sections/agents/agent_list_page/index.test.tsx | 1 + x-pack/plugins/fleet/server/mocks/index.ts | 1 + .../extension_point_storage_client.ts | 1 + .../lists/server/services/extension_points/types.ts | 1 + .../public/application/pages/apm/overview.tsx | 5 ++++- .../application/pages/enterprise_search/overview.tsx | 5 ++++- .../common/mock/endpoint/app_context_render.tsx | 12 ++++++++---- .../osquery/osquery_response_action.tsx | 1 + .../components/page_overlay/page_overlay.tsx | 1 + .../components/event_collection_card.tsx | 4 ++-- .../triggers_actions_ui/.storybook/decorator.tsx | 1 + .../common/experimental_features.ts | 1 + .../public/common/get_experimental_features.test.tsx | 1 + .../lib/alerts/duration_anomaly.test.ts | 1 + .../exception_operators_data_types/keyword_array.ts | 1 + 24 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/plugins/discover/public/components/doc_table/components/table_row.tsx b/src/plugins/discover/public/components/doc_table/components/table_row.tsx index a38e082778a68..391ca36ce422b 100644 --- a/src/plugins/discover/public/components/doc_table/components/table_row.tsx +++ b/src/plugins/discover/public/components/doc_table/components/table_row.tsx @@ -186,6 +186,7 @@ export const TableRow = ({ // We should improve this and show a helpful tooltip why the filter buttons are not // there/disabled when there are ignored values. const isFilterable = Boolean( + // @ts-expect-error ts upgrade v4.7.4 mapping(column)?.filterable && filter && !row.raw._ignored?.includes(column) ); rowCells.push( diff --git a/src/plugins/vis_types/heatmap/public/editor/components/labels_panel.tsx b/src/plugins/vis_types/heatmap/public/editor/components/labels_panel.tsx index 0b16e538fb481..59e4a20c8aac1 100644 --- a/src/plugins/vis_types/heatmap/public/editor/components/labels_panel.tsx +++ b/src/plugins/vis_types/heatmap/public/editor/components/labels_panel.tsx @@ -25,6 +25,7 @@ interface LabelsPanelProps { } function LabelsPanel({ valueAxis, setValue, isNewLibrary }: LabelsPanelProps) { + // @ts-expect-error ts upgrade v4.7.4 const rotateLabels = valueAxis.labels.rotate === VERTICAL_ROTATION; const setValueAxisLabels = useCallback( @@ -43,6 +44,7 @@ function LabelsPanel({ valueAxis, setValue, isNewLibrary }: LabelsPanelProps) { const setRotateLabels = useCallback( (paramName: 'rotate', value: boolean) => + // @ts-expect-error ts upgrade v4.7.4 setValueAxisLabels(paramName, value ? VERTICAL_ROTATION : 0), [setValueAxisLabels] ); diff --git a/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx index 2c7f394f6a0aa..fa5d9547e8157 100644 --- a/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx @@ -34,6 +34,7 @@ function LabelOptions({ }: LabelOptionsProps) { const setAxisLabelRotate = useCallback( (paramName: 'rotate', value: Labels['rotate']) => { + // @ts-expect-error ts upgrade v4.7.4 setAxisLabel(paramName, Number(value)); }, [setAxisLabel] @@ -96,6 +97,7 @@ function LabelOptions({ options={rotateOptions} paramName="rotate" value={axisLabels.rotate} + // @ts-ignore ts upgrade v4.7.4 setValue={setAxisLabelRotate} /> diff --git a/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/event_handlers.ts b/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/event_handlers.ts index bb06444c0c8f6..de0dc0702db6e 100644 --- a/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/event_handlers.ts +++ b/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/event_handlers.ts @@ -61,6 +61,8 @@ const setupHandler = (commit: CommitFn, canvasOrigin: CanvasOriginFn, zoomScale? // only commits the cursor position if there's a way to latch onto x/y calculation (canvasOrigin is knowable) // or if left button is being held down (i.e. an element is being dragged) + // + // @ts-expect-error ts upgrade v4.7.4 if (buttons === 1 || canvasOrigin) { commit('cursorPosition', { x, y, altKey, metaKey, shiftKey, ctrlKey }); } else { diff --git a/x-pack/plugins/cases/public/components/create/form.test.tsx b/x-pack/plugins/cases/public/components/create/form.test.tsx index 627b5ccd2e7b4..3c7b328bce929 100644 --- a/x-pack/plugins/cases/public/components/create/form.test.tsx +++ b/x-pack/plugins/cases/public/components/create/form.test.tsx @@ -69,6 +69,7 @@ describe('CreateCaseForm', () => { globalForm = form; return ( + // @ts-expect-error ts upgrade v4.7.4
{children}
diff --git a/x-pack/plugins/cases/public/components/markdown_editor/editable_markdown_renderer.test.tsx b/x-pack/plugins/cases/public/components/markdown_editor/editable_markdown_renderer.test.tsx index af114e8ec473e..636fa61b8d6f0 100644 --- a/x-pack/plugins/cases/public/components/markdown_editor/editable_markdown_renderer.test.tsx +++ b/x-pack/plugins/cases/public/components/markdown_editor/editable_markdown_renderer.test.tsx @@ -72,6 +72,7 @@ describe('EditableMarkdown', () => { }); return ( + // @ts-expect-error ts upgrade v4.7.4
{children}
diff --git a/x-pack/plugins/fleet/common/experimental_features.ts b/x-pack/plugins/fleet/common/experimental_features.ts index af8bbbc74790b..f1e6780d987d9 100644 --- a/x-pack/plugins/fleet/common/experimental_features.ts +++ b/x-pack/plugins/fleet/common/experimental_features.ts @@ -46,6 +46,7 @@ export const parseExperimentalConfigValue = (configValue: string[]): Experimenta throw new FleetInvalidExperimentalValue(`[${value}] is not a supported experimental feature`); } + // @ts-expect-error ts upgrade v4.7.4 enabledFeatures[value as keyof ExperimentalFeatures] = true; } diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.test.tsx index 019395c0cb5f6..9548f78f06ecf 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.test.tsx @@ -52,6 +52,7 @@ describe('Agent policy advanced options content', () => { // remove when feature flag is removed ExperimentalFeaturesService.init({ ...allowedExperimentalValues, + // @ts-expect-error ts upgrade v4.7.4 agentTamperProtectionEnabled: true, }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.test.tsx index 1958db916a402..97ec62dce1d87 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.test.tsx @@ -40,6 +40,7 @@ describe('AgentPolicyListPage', () => { // todo: this can be removed when agentTamperProtectionEnabled feature flag is enabled/deleted ExperimentalFeaturesService.init({ ...allowedExperimentalValues, + // @ts-expect-error ts upgrade v4.7.4 agentTamperProtectionEnabled: true, }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.test.tsx index 0089843c2626f..84394f1ab5c0d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.test.tsx @@ -286,6 +286,7 @@ describe('agent_list_page', () => { // todo: this can be removed when agentTamperProtectionEnabled feature flag is enabled/deleted ExperimentalFeaturesService.init({ ...allowedExperimentalValues, + // @ts-expect-error ts upgrade v4.7.4 agentTamperProtectionEnabled: true, }); diff --git a/x-pack/plugins/fleet/server/mocks/index.ts b/x-pack/plugins/fleet/server/mocks/index.ts index adc0ecb1931b4..1e3d0e5c52b0a 100644 --- a/x-pack/plugins/fleet/server/mocks/index.ts +++ b/x-pack/plugins/fleet/server/mocks/index.ts @@ -71,6 +71,7 @@ export const createAppContextStartContractMock = ( securitySetup: securityMock.createSetup(), securityStart: securityMock.createStart(), logger: loggingSystemMock.create().get(), + // @ts-expect-error ts upgrade v4.7.4 experimentalFeatures: { agentTamperProtectionEnabled: true, diagnosticFileUploadEnabled: true, diff --git a/x-pack/plugins/lists/server/services/extension_points/extension_point_storage_client.ts b/x-pack/plugins/lists/server/services/extension_points/extension_point_storage_client.ts index f2d2035459b54..b3ada7ac69cd5 100644 --- a/x-pack/plugins/lists/server/services/extension_points/extension_point_storage_client.ts +++ b/x-pack/plugins/lists/server/services/extension_points/extension_point_storage_client.ts @@ -45,6 +45,7 @@ export class ExtensionPointStorageClient implements ExtensionPointStorageClientI async pipeRun< T extends ExtensionPoint['type'], D extends NarrowExtensionPointToType = NarrowExtensionPointToType, + // @ts-expect-error ts upgrade v4.7.4 P extends Parameters = Parameters >( extensionType: T, diff --git a/x-pack/plugins/lists/server/services/extension_points/types.ts b/x-pack/plugins/lists/server/services/extension_points/types.ts index 61aa7c451362d..2a298e96d2656 100644 --- a/x-pack/plugins/lists/server/services/extension_points/types.ts +++ b/x-pack/plugins/lists/server/services/extension_points/types.ts @@ -185,6 +185,7 @@ export interface ExtensionPointStorageClientInterface { pipeRun< T extends ExtensionPoint['type'], D extends NarrowExtensionPointToType = NarrowExtensionPointToType, + // @ts-expect-error ts upgrade v4.7.4 P extends Parameters = Parameters >( extensionType: T, diff --git a/x-pack/plugins/monitoring/public/application/pages/apm/overview.tsx b/x-pack/plugins/monitoring/public/application/pages/apm/overview.tsx index 9dd30bf6db81a..e12b567d8340f 100644 --- a/x-pack/plugins/monitoring/public/application/pages/apm/overview.tsx +++ b/x-pack/plugins/monitoring/public/application/pages/apm/overview.tsx @@ -70,7 +70,10 @@ export const ApmOverviewPage: React.FC = ({ clusters }) => { getPageData={getPageData} data-test-subj="apmOverviewPage" > - {data && } + { + // @ts-expect-error ts upgrade v4.7.4 + data && + } ); }; diff --git a/x-pack/plugins/monitoring/public/application/pages/enterprise_search/overview.tsx b/x-pack/plugins/monitoring/public/application/pages/enterprise_search/overview.tsx index 0cd97166dcf5d..4493ec12adba4 100644 --- a/x-pack/plugins/monitoring/public/application/pages/enterprise_search/overview.tsx +++ b/x-pack/plugins/monitoring/public/application/pages/enterprise_search/overview.tsx @@ -69,7 +69,10 @@ export const EntSearchOverviewPage: React.FC = ({ clusters }) => data-test-subj="entSearchOverviewPage" >
- {data && } + { + // @ts-expect-error ts upgrade v4.7.4 + data && + }
); diff --git a/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx b/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx index 3c0e4620a4000..e70ca671d5c56 100644 --- a/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx +++ b/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx @@ -213,10 +213,14 @@ export const createAppRootMockRenderer = (): AppContextTestRender => { app: experimentalFeaturesReducer, }; - const store = createStore(mockGlobalState, storeReducer, kibanaObservable, storage, [ - ...managementMiddlewareFactory(coreStart, depsStart), - middlewareSpy.actionSpyMiddleware, - ]); + const store = createStore( + mockGlobalState, + storeReducer, + kibanaObservable, + storage, + // @ts-expect-error ts upgrade v4.7.4 + [...managementMiddlewareFactory(coreStart, depsStart), middlewareSpy.actionSpyMiddleware] + ); const queryClient = new QueryClient({ defaultOptions: { diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_response_actions/osquery/osquery_response_action.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_response_actions/osquery/osquery_response_action.tsx index 955a2f43966f7..3d42a95e2164a 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_response_actions/osquery/osquery_response_action.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_response_actions/osquery/osquery_response_action.tsx @@ -76,6 +76,7 @@ export const OsqueryResponseAction = React.memo((props: OsqueryResponseActionPro ); } + // @ts-expect-error ts upgrade v4.7.4 if (isMounted() && OsqueryForm) { return ( ( useEffect(() => { if ( isMounted() && + // @ts-expect-error ts upgrade v4.7.4 onHide && hideOnUrlPathnameChange && !isHidden && diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.tsx index 97bff346e35a3..df2d85bd69bcd 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.tsx @@ -134,7 +134,7 @@ export const EventCollectionCard = memo(
{options.map(({ name, protectionField }) => { - const keyPath = `${policyOs}.events.${protectionField}`; + const keyPath = `${policyOs}.events.${String(protectionField)}`; return ( { - const keyPath = `${policyOs}.events.${protectionField}`; + const keyPath = `${policyOs}.events.${String(protectionField)}`; const isChecked = get(policy, keyPath); const fieldString = protectionField as string; diff --git a/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx b/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx index 19fbb190162d4..8526d012b9e0e 100644 --- a/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx +++ b/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx @@ -58,6 +58,7 @@ export const StorybookContextDecorator: React.FC ExperimentalFeaturesService.init({ experimentalFeatures: { rulesListDatagrid: true, + // @ts-expect-error ts upgrade v4.7.4 internalAlertsTable: true, ruleTagFilter: true, ruleStatusFilter: true, diff --git a/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts b/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts index 66e87e0beaeec..918b49bf5500e 100644 --- a/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts +++ b/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts @@ -42,6 +42,7 @@ export const parseExperimentalConfigValue = (configValue: string[]): Experimenta throw new TriggersActionsUIInvalidExperimentalValue(`[${value}] is not valid.`); } + // @ts-expect-error ts upgrade v4.7.4 enabledFeatures[value as keyof ExperimentalFeatures] = true; } diff --git a/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx b/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx index 36514f6c90172..d4d1580025353 100644 --- a/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx @@ -16,6 +16,7 @@ describe('getIsExperimentalFeatureEnabled', () => { ExperimentalFeaturesService.init({ experimentalFeatures: { rulesListDatagrid: true, + // @ts-expect-error ts upgrade v4.7.4 internalAlertsTable: true, rulesDetailLogs: true, ruleTagFilter: true, diff --git a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.test.ts b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.test.ts index 21c20503f31ab..62100f7d198f3 100644 --- a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.test.ts +++ b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.test.ts @@ -118,6 +118,7 @@ describe('duration anomaly alert', () => { const mockDate = 'date'; beforeAll(() => { Date.now = jest.fn().mockReturnValue(new Date('2021-05-13T12:33:37.000Z')); + // @ts-expect-error ts upgrade v4.7.4 jest.spyOn(Intl, 'DateTimeFormat').mockImplementation(() => ({ format: jest.fn(), formatToParts: jest.fn(), diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/group8/exception_operators_data_types/keyword_array.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/group8/exception_operators_data_types/keyword_array.ts index e08d449584140..7d95f6c9ec6bc 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/group8/exception_operators_data_types/keyword_array.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/group8/exception_operators_data_types/keyword_array.ts @@ -154,6 +154,7 @@ export default ({ getService }: FtrProviderContext) => { await waitForSignalsToBePresent(supertest, log, 1, [id]); const signalsOpen = await getSignalsById(supertest, log, id); const hits = signalsOpen.hits.hits.map((hit) => hit._source?.keyword).sort(); + // @ts-expect-error ts upgrade v4.7.4 expect(hits.flat(Number.MAX_SAFE_INTEGER)).to.eql([]); }); }); From 07f9dd9e9321d3fa46e7ca733453f4060d9092b3 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 28 Jul 2023 21:41:30 +0100 Subject: [PATCH 05/25] chore(NA): solve conflicts on security solution team tsconfig --- x-pack/plugins/security_solution/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/tsconfig.json b/x-pack/plugins/security_solution/tsconfig.json index 6ac3e400a6541..5d9948e16e29f 100644 --- a/x-pack/plugins/security_solution/tsconfig.json +++ b/x-pack/plugins/security_solution/tsconfig.json @@ -12,8 +12,7 @@ "server/**/*.json", "scripts/**/*.json", "public/**/*.json", - "../../../typings/**/*", - "./public/management/cypress/cypress.d.ts" + "../../../typings/**/*" ], "exclude": [ "target/**/*", From e51b25f65b709b300279e206c621e27d4ccbd2e7 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Sat, 29 Jul 2023 03:24:30 +0100 Subject: [PATCH 06/25] test(NA): fix jest snapshots for ts_program test --- .../kbn-telemetry-tools/src/tools/ts_program/ts_program.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-telemetry-tools/src/tools/ts_program/ts_program.test.ts b/packages/kbn-telemetry-tools/src/tools/ts_program/ts_program.test.ts index 8ae36ea7330cc..7e15de907e31a 100644 --- a/packages/kbn-telemetry-tools/src/tools/ts_program/ts_program.test.ts +++ b/packages/kbn-telemetry-tools/src/tools/ts_program/ts_program.test.ts @@ -21,7 +21,7 @@ describe('createKibanaProgram', () => { "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 149, + "kind": 150, "type": "StringKeyword", }, }, From 18d1a323f0d20276682a3c00d221719b4ea1c31c Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:56:25 +0000 Subject: [PATCH 07/25] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- x-pack/performance/journeys/apm_service_inventory.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/performance/journeys/apm_service_inventory.ts b/x-pack/performance/journeys/apm_service_inventory.ts index d98b151c000d6..980c193f67bbb 100644 --- a/x-pack/performance/journeys/apm_service_inventory.ts +++ b/x-pack/performance/journeys/apm_service_inventory.ts @@ -35,7 +35,7 @@ export const journey = new Journey({ ); }, ftrConfigPath: 'x-pack/performance/configs/apm_config.ts', - skipped: true + skipped: true, }) .step('Navigate to Service Inventory Page', async ({ page, kbnUrl }) => { await page.goto(kbnUrl.get(`app/apm/services`)); From 9b4e11c3be36c02d55b115bb1478eeba9882c571 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 1 Aug 2023 17:06:06 +0100 Subject: [PATCH 08/25] chore(NA): fix type error on src/plugins/discover/public/components/doc_table/components/table_row.tsx --- .../public/components/doc_table/components/table_row.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/discover/public/components/doc_table/components/table_row.tsx b/src/plugins/discover/public/components/doc_table/components/table_row.tsx index 391ca36ce422b..538cfbf5bf730 100644 --- a/src/plugins/discover/public/components/doc_table/components/table_row.tsx +++ b/src/plugins/discover/public/components/doc_table/components/table_row.tsx @@ -186,8 +186,7 @@ export const TableRow = ({ // We should improve this and show a helpful tooltip why the filter buttons are not // there/disabled when there are ignored values. const isFilterable = Boolean( - // @ts-expect-error ts upgrade v4.7.4 - mapping(column)?.filterable && filter && !row.raw._ignored?.includes(column) + mapping(column)?.filterable && (typeof filter === 'function') && !row.raw._ignored?.includes(column) ); rowCells.push( Date: Tue, 1 Aug 2023 16:12:41 +0000 Subject: [PATCH 09/25] [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' --- .../public/components/doc_table/components/table_row.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/discover/public/components/doc_table/components/table_row.tsx b/src/plugins/discover/public/components/doc_table/components/table_row.tsx index 538cfbf5bf730..e1c00ec3397c0 100644 --- a/src/plugins/discover/public/components/doc_table/components/table_row.tsx +++ b/src/plugins/discover/public/components/doc_table/components/table_row.tsx @@ -186,7 +186,9 @@ export const TableRow = ({ // We should improve this and show a helpful tooltip why the filter buttons are not // there/disabled when there are ignored values. const isFilterable = Boolean( - mapping(column)?.filterable && (typeof filter === 'function') && !row.raw._ignored?.includes(column) + mapping(column)?.filterable && + typeof filter === 'function' && + !row.raw._ignored?.includes(column) ); rowCells.push( Date: Tue, 1 Aug 2023 17:46:57 +0100 Subject: [PATCH 10/25] choer(NA): revert ops code on repo packages modern library --- packages/kbn-repo-packages/modern/plugins.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/kbn-repo-packages/modern/plugins.js b/packages/kbn-repo-packages/modern/plugins.js index 31dd08bf1f5ba..9a2bc164fb31c 100644 --- a/packages/kbn-repo-packages/modern/plugins.js +++ b/packages/kbn-repo-packages/modern/plugins.js @@ -107,7 +107,15 @@ function getPluginPackagesFilter(selector = {}) { */ function getDistributablePacakgesFilter() { return (pkg) => { - if (pkg.isDevOnly()) { + // if (pkg.isDevOnly()) { + // return false; + // } + + if ( + pkg.isDevOnly || + pkg.manifest.type === 'functional-tests' || + pkg.manifest.type === 'test-helper' + ) { return false; } From 4651be3068f0f5c261109d6a8c657fb9a98d9b2e Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 1 Aug 2023 18:58:29 +0100 Subject: [PATCH 11/25] choer(NA): revert ops code on repo packages modern library --- packages/kbn-repo-packages/modern/plugins.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/kbn-repo-packages/modern/plugins.js b/packages/kbn-repo-packages/modern/plugins.js index 9a2bc164fb31c..66b71ed5f521a 100644 --- a/packages/kbn-repo-packages/modern/plugins.js +++ b/packages/kbn-repo-packages/modern/plugins.js @@ -111,6 +111,7 @@ function getDistributablePacakgesFilter() { // return false; // } + // @ts-expect-error upgrade ts if ( pkg.isDevOnly || pkg.manifest.type === 'functional-tests' || From 574b6a666122a2a9b5d508a45a80a01448e697eb Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 1 Aug 2023 19:05:58 +0100 Subject: [PATCH 12/25] choer(NA): revert ops code on repo packages modern library --- packages/kbn-repo-packages/modern/plugins.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-repo-packages/modern/plugins.js b/packages/kbn-repo-packages/modern/plugins.js index 66b71ed5f521a..847e49121f84c 100644 --- a/packages/kbn-repo-packages/modern/plugins.js +++ b/packages/kbn-repo-packages/modern/plugins.js @@ -111,8 +111,8 @@ function getDistributablePacakgesFilter() { // return false; // } - // @ts-expect-error upgrade ts if ( + // @ts-expect-error upgrade ts pkg.isDevOnly || pkg.manifest.type === 'functional-tests' || pkg.manifest.type === 'test-helper' From 5ce30958419862e86c53a8370cc0c7b53f026b05 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 1 Aug 2023 19:50:11 +0100 Subject: [PATCH 13/25] chore(NA): get back function refactor --- packages/kbn-repo-packages/modern/plugins.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/kbn-repo-packages/modern/plugins.js b/packages/kbn-repo-packages/modern/plugins.js index 847e49121f84c..31dd08bf1f5ba 100644 --- a/packages/kbn-repo-packages/modern/plugins.js +++ b/packages/kbn-repo-packages/modern/plugins.js @@ -107,16 +107,7 @@ function getPluginPackagesFilter(selector = {}) { */ function getDistributablePacakgesFilter() { return (pkg) => { - // if (pkg.isDevOnly()) { - // return false; - // } - - if ( - // @ts-expect-error upgrade ts - pkg.isDevOnly || - pkg.manifest.type === 'functional-tests' || - pkg.manifest.type === 'test-helper' - ) { + if (pkg.isDevOnly()) { return false; } From b85e09029b39f71bf0193b061ad54c9b0b595ad8 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Wed, 2 Aug 2023 17:43:41 +0100 Subject: [PATCH 14/25] chore(NA): apply uptime type fixes and removed expect error --- .../server/legacy_uptime/lib/alerts/duration_anomaly.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.test.ts b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.test.ts index 95d4e094b3428..7a48860265432 100644 --- a/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.test.ts +++ b/x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.test.ts @@ -118,7 +118,6 @@ describe('duration anomaly alert', () => { const mockDate = 'date'; beforeAll(() => { Date.now = jest.fn().mockReturnValue(new Date('2021-05-13T12:33:37.000Z')); - // @ts-expect-error ts upgrade v4.7.4 jest.spyOn(Intl, 'DateTimeFormat').mockImplementation(() => ({ format: jest.fn(), formatToParts: jest.fn(), From e716dfebe576c590f58f6fb5404d202114049a06 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Wed, 2 Aug 2023 18:13:17 +0100 Subject: [PATCH 15/25] fix(NA): types on test_serverless --- .../cypress/tasks/endpoint_management/response_actions.ts | 2 +- .../shared/lib/security/kibana_roles/role_loader.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/test_serverless/functional/test_suites/security/cypress/tasks/endpoint_management/response_actions.ts b/x-pack/test_serverless/functional/test_suites/security/cypress/tasks/endpoint_management/response_actions.ts index 52bf32414268a..cf371fe63c40a 100644 --- a/x-pack/test_serverless/functional/test_suites/security/cypress/tasks/endpoint_management/response_actions.ts +++ b/x-pack/test_serverless/functional/test_suites/security/cypress/tasks/endpoint_management/response_actions.ts @@ -33,7 +33,7 @@ export const ensureResponseActionAuthzAccess = ( password: string ): Cypress.Chainable => { let url: string = ''; - let apiPayload: unknown = { + let apiPayload: any = { endpoint_ids: ['some-id'], }; diff --git a/x-pack/test_serverless/shared/lib/security/kibana_roles/role_loader.ts b/x-pack/test_serverless/shared/lib/security/kibana_roles/role_loader.ts index e5a8979d6e729..fcdbfc93d7c42 100644 --- a/x-pack/test_serverless/shared/lib/security/kibana_roles/role_loader.ts +++ b/x-pack/test_serverless/shared/lib/security/kibana_roles/role_loader.ts @@ -50,7 +50,7 @@ export class RoleAndUserLoader = Record Date: Thu, 3 Aug 2023 14:45:42 +0100 Subject: [PATCH 16/25] fix(NA): replace any by KibanaRequest in x-pack/plugins/security/server/authentication/authenticator.ts --- .../plugins/security/server/authentication/authenticator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security/server/authentication/authenticator.ts b/x-pack/plugins/security/server/authentication/authenticator.ts index 1f6c101a16b5a..6f170f607bfcf 100644 --- a/x-pack/plugins/security/server/authentication/authenticator.ts +++ b/x-pack/plugins/security/server/authentication/authenticator.ts @@ -259,7 +259,7 @@ export class Authenticator { ...providerCommonOptions, name, logger: options.loggers.get(type, name), - urls: { loggedOut: (request: any) => this.getLoggedOutURL(request, type) }, + urls: { loggedOut: (request: KibanaRequest) => this.getLoggedOutURL(request, type) }, }), this.options.config.authc.providers[type]?.[name] ), @@ -275,7 +275,7 @@ export class Authenticator { name: '__http__', logger: options.loggers.get(HTTPAuthenticationProvider.type), urls: { - loggedOut: (request: any) => + loggedOut: (request: KibanaRequest) => this.getLoggedOutURL(request, HTTPAuthenticationProvider.type), }, }) From fa884df2f6d650e92698fc54026aefa0a40e9e6e Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 4 Aug 2023 16:14:09 +0100 Subject: [PATCH 17/25] chore(na): update packages/core/http/core-http-router-server-internal/src/request.ts Co-authored-by: Michael Dokolin --- .../core/http/core-http-router-server-internal/src/request.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/http/core-http-router-server-internal/src/request.ts b/packages/core/http/core-http-router-server-internal/src/request.ts index 38c387585b262..0a1795498891e 100644 --- a/packages/core/http/core-http-router-server-internal/src/request.ts +++ b/packages/core/http/core-http-router-server-internal/src/request.ts @@ -116,8 +116,7 @@ export class CoreKibanaRequest< public readonly rewrittenUrl?: URL; /** @internal */ - // @ts-expect-error property is assigned with defineProperty in the constructor - protected readonly [requestSymbol]: Request; + protected readonly [requestSymbol]!: Request; constructor( request: RawRequest, From ea5d7e5fb97147399e440e8e031366f1054e5281 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 4 Aug 2023 16:15:46 +0100 Subject: [PATCH 18/25] chore(NA): update x-pack/plugins/security/server/session_management/session_index.ts --- .../server/session_management/session_index.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/security/server/session_management/session_index.ts b/x-pack/plugins/security/server/session_management/session_index.ts index 62c573f5cbd74..70d0bb109115b 100644 --- a/x-pack/plugins/security/server/session_management/session_index.ts +++ b/x-pack/plugins/security/server/session_management/session_index.ts @@ -90,7 +90,6 @@ export function getSessionIndexSettings({ indexName: string; aliasName: string; }): IndicesCreateRequest { - // @ts-expect-error ts upgrade to v4.7.4 return Object.freeze({ index: indexName, settings: { @@ -107,16 +106,16 @@ export function getSessionIndexSettings({ }, }, mappings: { - dynamic: 'strict', + dynamic: 'strict' as const, _meta: { [SESSION_INDEX_MAPPINGS_VERSION_META_FIELD_NAME]: SESSION_INDEX_MAPPINGS_VERSION }, properties: { - usernameHash: { type: 'keyword' }, - provider: { properties: { name: { type: 'keyword' }, type: { type: 'keyword' } } }, - idleTimeoutExpiration: { type: 'date' }, - createdAt: { type: 'date' }, - lifespanExpiration: { type: 'date' }, - accessAgreementAcknowledged: { type: 'boolean' }, - content: { type: 'binary' }, + usernameHash: { type: 'keyword' as const }, + provider: { properties: { name: { type: 'keyword' as const }, type: { type: 'keyword'as const } } }, + idleTimeoutExpiration: { type: 'date' as const }, + createdAt: { type: 'date' as const }, + lifespanExpiration: { type: 'date' as const }, + accessAgreementAcknowledged: { type: 'boolean' as const }, + content: { type: 'binary' as const }, }, }, }); From 8d34c313580762e6064590d7c3bb1a4569e082a4 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:21:18 +0000 Subject: [PATCH 19/25] [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' --- .../security/server/session_management/session_index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security/server/session_management/session_index.ts b/x-pack/plugins/security/server/session_management/session_index.ts index 70d0bb109115b..d3813cb9929d7 100644 --- a/x-pack/plugins/security/server/session_management/session_index.ts +++ b/x-pack/plugins/security/server/session_management/session_index.ts @@ -110,7 +110,9 @@ export function getSessionIndexSettings({ _meta: { [SESSION_INDEX_MAPPINGS_VERSION_META_FIELD_NAME]: SESSION_INDEX_MAPPINGS_VERSION }, properties: { usernameHash: { type: 'keyword' as const }, - provider: { properties: { name: { type: 'keyword' as const }, type: { type: 'keyword'as const } } }, + provider: { + properties: { name: { type: 'keyword' as const }, type: { type: 'keyword' as const } }, + }, idleTimeoutExpiration: { type: 'date' as const }, createdAt: { type: 'date' as const }, lifespanExpiration: { type: 'date' as const }, From f33aa04cedfe408a22dba17a68d9cc29e9a9bcc1 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Mon, 7 Aug 2023 18:30:51 +0300 Subject: [PATCH 20/25] [Visualizations] fix types on TS upgrade (#16) * [Visualizations] fix types on TS upgrade * PR comment --- .../charts/common/static/components/collections.ts | 1 + src/plugins/expressions/common/execution/execution.ts | 9 +++------ .../heatmap/public/editor/components/labels_panel.tsx | 2 -- .../components/options/metrics_axes/label_options.tsx | 6 +++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/plugins/charts/common/static/components/collections.ts b/src/plugins/charts/common/static/components/collections.ts index 1f138ab9f7b0e..acb11c647fead 100644 --- a/src/plugins/charts/common/static/components/collections.ts +++ b/src/plugins/charts/common/static/components/collections.ts @@ -20,6 +20,7 @@ export const LabelRotation = Object.freeze({ Horizontal: 0, Vertical: 90, Angled: 75, + VerticalRotation: 270, }); export type LabelRotation = $Values; diff --git a/src/plugins/expressions/common/execution/execution.ts b/src/plugins/expressions/common/execution/execution.ts index 1e010be4e9557..7b4e02df0a3d8 100644 --- a/src/plugins/expressions/common/execution/execution.ts +++ b/src/plugins/expressions/common/execution/execution.ts @@ -420,21 +420,18 @@ export class Execution< : of(resolvedArgs); return args$.pipe( - // @ts-expect-error upgrade to ts v4.7.4 - tap((args) => this.execution.params.debug && Object.assign(head.debug, { args })), + tap((args) => this.execution.params.debug && { ...head.debug, args }), switchMap((args) => this.invokeFunction(fn, input, args)), this.execution.params.partial ? identity : last(), switchMap((output) => (getType(output) === 'error' ? throwError(output) : of(output))), - // @ts-expect-error upgrade to ts v4.7.4 - tap((output) => this.execution.params.debug && Object.assign(head.debug, { output })), + tap((output) => this.execution.params.debug && { ...head.debug, output }), switchMap((output) => this.invokeChain(tail, output)), catchError((rawError) => { const error = createError(rawError); error.error.message = `[${fnName}] > ${error.error.message}`; if (this.execution.params.debug) { - // @ts-expect-error upgrade to ts v4.7.4 - Object.assign(head.debug, { error, rawError, success: false }); + Object.assign(head.debug ?? {}, { error, rawError, success: false }); } return of(error); diff --git a/src/plugins/vis_types/heatmap/public/editor/components/labels_panel.tsx b/src/plugins/vis_types/heatmap/public/editor/components/labels_panel.tsx index 59e4a20c8aac1..0b16e538fb481 100644 --- a/src/plugins/vis_types/heatmap/public/editor/components/labels_panel.tsx +++ b/src/plugins/vis_types/heatmap/public/editor/components/labels_panel.tsx @@ -25,7 +25,6 @@ interface LabelsPanelProps { } function LabelsPanel({ valueAxis, setValue, isNewLibrary }: LabelsPanelProps) { - // @ts-expect-error ts upgrade v4.7.4 const rotateLabels = valueAxis.labels.rotate === VERTICAL_ROTATION; const setValueAxisLabels = useCallback( @@ -44,7 +43,6 @@ function LabelsPanel({ valueAxis, setValue, isNewLibrary }: LabelsPanelProps) { const setRotateLabels = useCallback( (paramName: 'rotate', value: boolean) => - // @ts-expect-error ts upgrade v4.7.4 setValueAxisLabels(paramName, value ? VERTICAL_ROTATION : 0), [setValueAxisLabels] ); diff --git a/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx index fa5d9547e8157..3310df7259df6 100644 --- a/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx @@ -13,7 +13,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { SelectOption, SwitchOption } from '@kbn/vis-default-editor-plugin/public'; -import { Labels } from '@kbn/charts-plugin/public'; +import type { LabelRotation, Labels } from '@kbn/charts-plugin/public'; import { TruncateLabelsOption } from '../../common'; import { getRotateOptions } from '../../../collections'; @@ -34,8 +34,8 @@ function LabelOptions({ }: LabelOptionsProps) { const setAxisLabelRotate = useCallback( (paramName: 'rotate', value: Labels['rotate']) => { - // @ts-expect-error ts upgrade v4.7.4 - setAxisLabel(paramName, Number(value)); + const rotation = Number(value) as LabelRotation; + setAxisLabel(paramName, rotation); }, [setAxisLabel] ); From a746d2c49a1ed690e5ac682040879679777ee3db Mon Sep 17 00:00:00 2001 From: Rudolf Meijering Date: Mon, 7 Aug 2023 18:28:57 +0200 Subject: [PATCH 21/25] Improve Core types in preparation for ts v4.7.4 (#17) --- .../src/versioned_router/core_versioned_route.ts | 12 ++++++------ .../src/versioned_router/route_version_utils.ts | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts index 1c972b346c353..dd1a0c21d5593 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts @@ -161,9 +161,9 @@ export class CoreVersionedRoute implements VersionedRoute { ) { try { const { body, params, query } = validate(req, validation.request, handler.options.version); - (req as Mutable).body = body; - (req as Mutable).params = params; - (req as Mutable).query = query; + req.body = body; + req.params = params; + req.query = query; } catch (e) { return res.badRequest({ body: e.message, @@ -171,9 +171,9 @@ export class CoreVersionedRoute implements VersionedRoute { } } else { // Preserve behavior of not passing through unvalidated data - (req as Mutable).body = {}; - (req as Mutable).params = {}; - (req as Mutable).query = {}; + req.body = {}; + req.params = {}; + req.query = {}; } const response = await handler.fn(ctx, req, res); diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/route_version_utils.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/route_version_utils.ts index c5e6ff5967deb..6d22046ed81e1 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/route_version_utils.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/route_version_utils.ts @@ -52,7 +52,9 @@ type KibanaRequestWithQueryVersion = KibanaRequest< { [ELASTIC_HTTP_VERSION_QUERY_PARAM]: unknown } >; -export function hasQueryVersion(request: KibanaRequest): request is KibanaRequestWithQueryVersion { +export function hasQueryVersion( + request: Mutable +): request is Mutable { return isObject(request.query) && ELASTIC_HTTP_VERSION_QUERY_PARAM in request.query; } export function removeQueryVersion(request: Mutable): void { From f1f2f2dea34faaaf5a6e014b9887c462b068e10b Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Mon, 7 Aug 2023 18:13:19 +0100 Subject: [PATCH 22/25] fix(NA): tests on src/plugins/expressions/common/execution/execution.ts --- src/plugins/expressions/common/execution/execution.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/expressions/common/execution/execution.ts b/src/plugins/expressions/common/execution/execution.ts index 7b4e02df0a3d8..3b6c41f245568 100644 --- a/src/plugins/expressions/common/execution/execution.ts +++ b/src/plugins/expressions/common/execution/execution.ts @@ -420,11 +420,11 @@ export class Execution< : of(resolvedArgs); return args$.pipe( - tap((args) => this.execution.params.debug && { ...head.debug, args }), + tap((args) => this.execution.params.debug && Object.assign(head.debug ?? {}, { args })), switchMap((args) => this.invokeFunction(fn, input, args)), this.execution.params.partial ? identity : last(), switchMap((output) => (getType(output) === 'error' ? throwError(output) : of(output))), - tap((output) => this.execution.params.debug && { ...head.debug, output }), + tap((output) => this.execution.params.debug && Object.assign(head.debug ?? {}, { output })), switchMap((output) => this.invokeChain(tail, output)), catchError((rawError) => { const error = createError(rawError); @@ -440,8 +440,7 @@ export class Execution< }), finalize(() => { if (this.execution.params.debug) { - // @ts-expect-error upgrade to ts v4.7.4 - Object.assign(head.debug, { duration: now() - timeStart }); + Object.assign(head.debug ?? {}, { duration: now() - timeStart }); } }) ); From 1752054f358527f972f90dfaa0491229786d50f6 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:48:09 +0000 Subject: [PATCH 23/25] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- src/plugins/expressions/common/execution/execution.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/expressions/common/execution/execution.ts b/src/plugins/expressions/common/execution/execution.ts index 3b6c41f245568..593e437fd9dc7 100644 --- a/src/plugins/expressions/common/execution/execution.ts +++ b/src/plugins/expressions/common/execution/execution.ts @@ -424,7 +424,9 @@ export class Execution< switchMap((args) => this.invokeFunction(fn, input, args)), this.execution.params.partial ? identity : last(), switchMap((output) => (getType(output) === 'error' ? throwError(output) : of(output))), - tap((output) => this.execution.params.debug && Object.assign(head.debug ?? {}, { output })), + tap( + (output) => this.execution.params.debug && Object.assign(head.debug ?? {}, { output }) + ), switchMap((output) => this.invokeChain(tail, output)), catchError((rawError) => { const error = createError(rawError); From 0eb2eadac1b5f65798f62eabb94b9b35465d3fa7 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Wed, 9 Aug 2023 18:03:53 +0100 Subject: [PATCH 24/25] chore(NA): update x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/event_handlers.ts Co-authored-by: Devon Thomson --- .../workpad_page/workpad_interactive_page/event_handlers.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/event_handlers.ts b/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/event_handlers.ts index de0dc0702db6e..ca187a8381d29 100644 --- a/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/event_handlers.ts +++ b/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/event_handlers.ts @@ -62,8 +62,7 @@ const setupHandler = (commit: CommitFn, canvasOrigin: CanvasOriginFn, zoomScale? // only commits the cursor position if there's a way to latch onto x/y calculation (canvasOrigin is knowable) // or if left button is being held down (i.e. an element is being dragged) // - // @ts-expect-error ts upgrade v4.7.4 - if (buttons === 1 || canvasOrigin) { + if (buttons === 1 || canvasOrigin !== undefined) { commit('cursorPosition', { x, y, altKey, metaKey, shiftKey, ctrlKey }); } else { // clears cursorPosition From 9727f612308117253dfe4d8e55b37f29d8168e3f Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 24 Aug 2023 01:46:14 +0100 Subject: [PATCH 25/25] fix(NA): new type errors --- src/plugins/console/public/lib/autocomplete/autocomplete.ts | 3 ++- .../__jest__/client_integration/index_details_page/mocks.ts | 1 + x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx | 1 + .../public/common/get_experimental_features.test.tsx | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/console/public/lib/autocomplete/autocomplete.ts b/src/plugins/console/public/lib/autocomplete/autocomplete.ts index 2f6e1404e2ce7..970847ac6bedc 100644 --- a/src/plugins/console/public/lib/autocomplete/autocomplete.ts +++ b/src/plugins/console/public/lib/autocomplete/autocomplete.ts @@ -42,7 +42,8 @@ function isUrlParamsToken(token: { type: string } | null) { } } -const tracer = (...args) => { +const tracer = (...args: any[]) => { + // @ts-expect-error ts upgrade v4.7.4 if (window.autocomplete_trace) { // eslint-disable-next-line no-console console.log.call( diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/mocks.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/mocks.ts index 02dda142de54a..d96f1d0fac0dc 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/mocks.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/mocks.ts @@ -21,6 +21,7 @@ export const testIndexMock: Index = { isFrozen: false, aliases: 'none', hidden: false, + // @ts-expect-error ts upgrade v4.7.4 isRollupIndex: false, ilm: { index: 'test_index', diff --git a/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx b/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx index 8526d012b9e0e..14180d867d7ea 100644 --- a/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx +++ b/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx @@ -64,6 +64,7 @@ export const StorybookContextDecorator: React.FC ruleStatusFilter: true, rulesDetailLogs: true, ruleUseExecutionStatus: false, + // @ts-expect-error ts upgrade v4.7.4 ruleKqlBar: true, }, }); diff --git a/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx b/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx index d4d1580025353..1b6e424e3883c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx @@ -22,6 +22,7 @@ describe('getIsExperimentalFeatureEnabled', () => { ruleTagFilter: true, ruleStatusFilter: true, ruleUseExecutionStatus: false, + // @ts-expect-error ts upgrade v4.7.4 ruleKqlBar: true, }, });