diff --git a/package.json b/package.json index da3a9d3ebd66ee..0e54bde2d64075 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "**/isomorphic-fetch/node-fetch": "^2.6.7", "**/remark-parse/trim": "1.0.1", "**/sharp": "0.32.6", - "**/typescript": "4.7.4", + "**/typescript": "4.9.5", "globby/fast-glob": "^3.2.11" }, "dependencies": { @@ -1677,7 +1677,7 @@ "tree-kill": "^1.2.2", "ts-morph": "^15.1.0", "tsd": "^0.20.0", - "typescript": "4.7.4", + "typescript": "4.9.5", "url-loader": "^2.2.0", "val-loader": "^1.1.1", "vinyl-fs": "^4.0.0", diff --git a/packages/analytics/client/src/analytics_client/analytics_client.ts b/packages/analytics/client/src/analytics_client/analytics_client.ts index 1029a87f2b9355..6844882459c84c 100644 --- a/packages/analytics/client/src/analytics_client/analytics_client.ts +++ b/packages/analytics/client/src/analytics_client/analytics_client.ts @@ -168,6 +168,7 @@ export class AnalyticsClient implements IAnalyticsClient { this.optInConfig$.next(optInConfigInstance); }; + // @ts-expect-error upgrade typescript v4.9.5 public registerContextProvider = (contextProviderOpts: ContextProviderOpts) => { this.contextService.registerContextProvider(contextProviderOpts); }; diff --git a/packages/analytics/client/src/analytics_client/context_service.ts b/packages/analytics/client/src/analytics_client/context_service.ts index 9f1bd40d15ee8f..75074c94a3fc0b 100644 --- a/packages/analytics/client/src/analytics_client/context_service.ts +++ b/packages/analytics/client/src/analytics_client/context_service.ts @@ -30,7 +30,7 @@ export class ContextService { public registerContextProvider({ name, context$, - schema, + schema, // @ts-expect-error upgrade typescript v4.9.5 }: ContextProviderOpts) { if (this.contextProvidersSubscriptions.has(name)) { throw new Error(`Context provider with name '${name}' already registered`); @@ -60,6 +60,7 @@ export class ContextService { .subscribe((context) => { // We store each context linked to the context provider so they can increase and reduce // the number of fields they report without having left-overs in the global context. + // @ts-expect-error upgrade typescript v4.9.5 this.contextProvidersRegistry.set(name, context); // For every context change, we rebuild the global context. diff --git a/packages/analytics/client/src/analytics_client/types.ts b/packages/analytics/client/src/analytics_client/types.ts index 5726bf00466879..8188ecde861616 100644 --- a/packages/analytics/client/src/analytics_client/types.ts +++ b/packages/analytics/client/src/analytics_client/types.ts @@ -205,6 +205,7 @@ export interface IAnalyticsClient { * * @track-adoption */ + // @ts-expect-error upgrade typescript v4.9.5 registerContextProvider: (contextProviderOpts: ContextProviderOpts) => void; /** * Removes the context provider and stop enriching the events from its context. diff --git a/packages/content-management/content_editor/src/__jest__/tests.helpers.tsx b/packages/content-management/content_editor/src/__jest__/tests.helpers.tsx index d71b237010c1ce..78097e6223e023 100644 --- a/packages/content-management/content_editor/src/__jest__/tests.helpers.tsx +++ b/packages/content-management/content_editor/src/__jest__/tests.helpers.tsx @@ -32,6 +32,7 @@ export function WithServices

(Comp: ComponentType

, overrides: Partial + {/* @ts-expect-error upgrade typescript v4.9.5*/} ); diff --git a/packages/core/http/core-http-router-server-internal/src/validator.ts b/packages/core/http/core-http-router-server-internal/src/validator.ts index 3294c4a6dcc637..8e9f700915e1a3 100644 --- a/packages/core/http/core-http-router-server-internal/src/validator.ts +++ b/packages/core/http/core-http-router-server-internal/src/validator.ts @@ -127,8 +127,10 @@ export class RouteValidator

{ namespace?: string ): RouteValidationResultType { if (isConfigSchema(validationRule)) { + // @ts-expect-error upgrade typescript v4.9.5 return validationRule.validate(data, {}, namespace); } else if (typeof validationRule === 'function') { + // @ts-expect-error upgrade typescript v4.9.5 return this.validateFunction(validationRule, data, namespace); } else { throw new ValidationError( diff --git a/packages/core/http/core-http-server-internal/src/cookie_session_storage.ts b/packages/core/http/core-http-server-internal/src/cookie_session_storage.ts index bba5a9742edb61..94dbd10970cc57 100644 --- a/packages/core/http/core-http-server-internal/src/cookie_session_storage.ts +++ b/packages/core/http/core-http-server-internal/src/cookie_session_storage.ts @@ -113,6 +113,7 @@ export async function createCookieSessionStorageFactory( return { asScoped(request: KibanaRequest) { + // @ts-expect-error upgrade typescript v4.9.5 return new ScopedCookieSessionStorage(log, server, ensureRawRequest(request)); }, }; diff --git a/packages/core/plugins/core-plugins-server-internal/src/create_browser_config.ts b/packages/core/plugins/core-plugins-server-internal/src/create_browser_config.ts index 05844839934b28..5d11064567479e 100644 --- a/packages/core/plugins/core-plugins-server-internal/src/create_browser_config.ts +++ b/packages/core/plugins/core-plugins-server-internal/src/create_browser_config.ts @@ -61,7 +61,6 @@ function checkIsPathExposed( // Traverse the path to see if it is exposed or not const exposedConfig = descriptor[key as keyof ExposedToBrowserDescriptor]; if (exposedConfig && typeof exposedConfig === 'object') { - // @ts-expect-error Type 'undefined' is not assignable to type 'ExposedToBrowserDescriptor' descriptor = exposedConfig; continue; } diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/bulk_update.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/bulk_update.ts index 9c119ff86e7ddb..b195141924659a 100644 --- a/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/bulk_update.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/bulk_update.ts @@ -262,6 +262,7 @@ export const performBulkUpdate = async ( const typeDefinition = registry.getType(type)!; const updatedAttributes = mergeForUpdate({ + // @ts-expect-error upgrade typescript v4.9.5 targetAttributes: { ...migrated!.attributes, }, diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/update.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/update.ts index 61f9cb4cfdb273..e25320f8a842e2 100644 --- a/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/update.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/update.ts @@ -247,6 +247,7 @@ export const executeUpdate = async ( // therefor we can safely process with the "standard" update sequence. const updatedAttributes = mergeForUpdate({ + // @ts-expect-error upgrade typescript v4.9.5 targetAttributes: { ...migrated!.attributes, }, diff --git a/packages/kbn-apm-synthtrace-client/src/lib/interval.ts b/packages/kbn-apm-synthtrace-client/src/lib/interval.ts index bf08344f4de9e8..bb77e6f6ee350f 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/interval.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/interval.ts @@ -32,7 +32,7 @@ interface IntervalOptions { rate?: number; } -export class Interval { +export class Interval { private readonly intervalAmount: number; private readonly intervalUnit: unitOfTime.DurationConstructor; @@ -63,7 +63,7 @@ export class Interval { return timestamps; } - *generator( + *generator( map: ( timestamp: number, index: number diff --git a/packages/kbn-apm-synthtrace/src/lib/shared/get_serialize_transform.ts b/packages/kbn-apm-synthtrace/src/lib/shared/get_serialize_transform.ts index ed93c9502b722d..3384a847db6b2e 100644 --- a/packages/kbn-apm-synthtrace/src/lib/shared/get_serialize_transform.ts +++ b/packages/kbn-apm-synthtrace/src/lib/shared/get_serialize_transform.ts @@ -37,6 +37,7 @@ export function getSerializeTransform() { push(this, nextEvents, nextCallback); } }, + // @ts-expect-error upgrade typescript v4.9.5 write(chunk: Serializable, encoding, callback) { push(this, chunk.serialize(), callback); }, diff --git a/packages/kbn-apm-synthtrace/src/lib/utils/with_client.ts b/packages/kbn-apm-synthtrace/src/lib/utils/with_client.ts index 68dc780ac64646..5acbcdfbbd9f35 100644 --- a/packages/kbn-apm-synthtrace/src/lib/utils/with_client.ts +++ b/packages/kbn-apm-synthtrace/src/lib/utils/with_client.ts @@ -12,7 +12,9 @@ import { ApmSynthtraceEsClient, LogsSynthtraceEsClient } from '../../..'; export type SynthtraceEsClient = ApmSynthtraceEsClient | LogsSynthtraceEsClient; export type SynthGenerator = + // @ts-expect-error upgrade typescript v4.9.5 | SynthtraceGenerator + // @ts-expect-error upgrade typescript v4.9.5 | Array> | Readable; diff --git a/packages/kbn-es-types/src/search.ts b/packages/kbn-es-types/src/search.ts index 4351ac91e5c170..df8d24e6974689 100644 --- a/packages/kbn-es-types/src/search.ts +++ b/packages/kbn-es-types/src/search.ts @@ -593,7 +593,8 @@ export type AggregateOf< export type AggregateOfMap = { [TAggregationName in keyof TAggregationMap]: Required[TAggregationName] extends AggregationsAggregationContainer - ? AggregateOf + ? // @ts-expect-error not sure how to fix this, anything I've tried causes errors upstream - Dario + AggregateOf : never; // using never means we effectively ignore optional keys, using {} creates a union type of { ... } | {} }; diff --git a/packages/kbn-io-ts-utils/src/to_json_schema/index.ts b/packages/kbn-io-ts-utils/src/to_json_schema/index.ts index 702c0150d07f74..ee595ae6de6d17 100644 --- a/packages/kbn-io-ts-utils/src/to_json_schema/index.ts +++ b/packages/kbn-io-ts-utils/src/to_json_schema/index.ts @@ -7,7 +7,7 @@ */ import * as t from 'io-ts'; import { mapValues } from 'lodash'; -import { isParsableType } from '../parseable_types'; +import { isParsableType, ParseableType } from '../parseable_types'; interface JSONSchemaObject { type: 'object'; @@ -45,7 +45,7 @@ type JSONSchema = | JSONSchemaAllOf | JSONSchemaAnyOf; -export const toJsonSchema = (type: t.Mixed): JSONSchema => { +export const toJsonSchema = (type: t.Type | ParseableType): JSONSchema => { if (isParsableType(type)) { switch (type._tag) { case 'ArrayType': diff --git a/packages/kbn-optimizer/src/common/obj_helpers.ts b/packages/kbn-optimizer/src/common/obj_helpers.ts index f238eb22e93a11..bf8d60a363f282 100644 --- a/packages/kbn-optimizer/src/common/obj_helpers.ts +++ b/packages/kbn-optimizer/src/common/obj_helpers.ts @@ -8,7 +8,7 @@ export function omit(obj: T, keys: K[]): Omit { const result: any = {}; - for (const [key, value] of Object.entries(obj) as any) { + for (const [key, value] of Object.entries(obj as any) as any) { if (!keys.includes(key)) { result[key] = value; } diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.test.ts index 6e2e671dbb0296..fb5db89dbb2292 100644 --- a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.test.ts +++ b/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.test.ts @@ -42,6 +42,7 @@ describe('threat_mapping', () => { field: 'field.one', type: 'mapping', value: 'field.one', + // @ts-expect-error upgrade typescript v4.9.5 extra: 'blah', }, ]; @@ -120,6 +121,7 @@ describe('threat_mapping', () => { value: 'field.one', }, ], + // @ts-expect-error upgrade typescript v4.9.5 extra: 'invalid', }, ]; @@ -140,6 +142,7 @@ describe('threat_mapping', () => { field: 'field.one', type: 'mapping', value: 'field.one', + // @ts-expect-error upgrade typescript v4.9.5 extra: 'blah', }, ], diff --git a/packages/kbn-securitysolution-utils/src/add_remove_id_to_item/index.ts b/packages/kbn-securitysolution-utils/src/add_remove_id_to_item/index.ts index 37a58438e62f24..d08b2f54e6e7e6 100644 --- a/packages/kbn-securitysolution-utils/src/add_remove_id_to_item/index.ts +++ b/packages/kbn-securitysolution-utils/src/add_remove_id_to_item/index.ts @@ -19,6 +19,7 @@ import { v4 as uuidv4 } from 'uuid'; */ type NotArray = T extends unknown[] ? never : T; export const addIdToItem = (item: NotArray): T => { + // @ts-expect-error upgrade typescript v4.9.5 const maybeId: typeof item & { id?: string } = item; if (maybeId.id != null) { return item; @@ -41,6 +42,7 @@ export const removeIdFromItem = ( }, Exclude > => { + // @ts-expect-error upgrade typescript v4.9.5 const maybeId: typeof item & { id?: string } = item; if (maybeId.id != null) { const { id, ...noId } = maybeId; diff --git a/packages/kbn-server-route-repository/src/test_types.ts b/packages/kbn-server-route-repository/src/test_types.ts index 46e9a258c0b35f..4cfd82de450b8c 100644 --- a/packages/kbn-server-route-repository/src/test_types.ts +++ b/packages/kbn-server-route-repository/src/test_types.ts @@ -69,11 +69,10 @@ createServerRouteFactory<{}, { options: { tags: string[] } }>()({ }); // Public APIs should be versioned +// @ts-expect-error createServerRouteFactory<{}, { options: { tags: string[] } }>()({ - // @ts-expect-error endpoint: 'GET /api/endpoint_with_params', options: { - // @ts-expect-error tags: [], }, // @ts-expect-error 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 7e15de907e31a3..72910fbe99fc45 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": 150, + "kind": 152, "type": "StringKeyword", }, }, diff --git a/packages/kbn-utility-types/src/dot.ts b/packages/kbn-utility-types/src/dot.ts index 7880e1e8dab969..e39ca10b8cc5f6 100644 --- a/packages/kbn-utility-types/src/dot.ts +++ b/packages/kbn-utility-types/src/dot.ts @@ -41,7 +41,9 @@ type DotKey< TKey extends keyof TObject & string, TPrefix extends string > = TObject[TKey] extends Array - ? ToArray> + ? TValueType extends Record + ? ToArray> + : never : TObject[TKey] extends Record ? DotObject : { [key in `${TPrefix}${TKey}`]: TObject[TKey] }; diff --git a/packages/shared-ux/router/impl/routes.tsx b/packages/shared-ux/router/impl/routes.tsx index 58dca46f1c0250..80d4da6178ae2e 100644 --- a/packages/shared-ux/router/impl/routes.tsx +++ b/packages/shared-ux/router/impl/routes.tsx @@ -30,9 +30,12 @@ export const Routes = ({ if (React.isValidElement(child) && child.type === LegacyRoute) { const path = replace(child?.props.path, match.url + '/', ''); const renderFunction = + // @ts-expect-error upgrade typescript v4.9.5 typeof child?.props.children === 'function' - ? child?.props.children - : child?.props.render; + ? // @ts-expect-error upgrade typescript v4.9.5 + child?.props.children + : // @ts-expect-error upgrade typescript v4.9.5 + child?.props.render; return ( + {/* @ts-expect-error upgrade typescript v4.9.5*/} {(child?.props?.component && ) || (renderFunction && renderFunction()) || children} diff --git a/src/core/server/mocks.ts b/src/core/server/mocks.ts index b76a9c37dd6dab..1294bc56ead54c 100644 --- a/src/core/server/mocks.ts +++ b/src/core/server/mocks.ts @@ -143,6 +143,7 @@ export type CustomRequestHandlerMock = { }; const createCustomRequestHandlerContextMock = (contextParts: T): CustomRequestHandlerMock => { + // @ts-expect-error upgrade typescript v4.9.5 const mock = Object.entries(contextParts).reduce( (context, [key, value]) => { // @ts-expect-error type matching from inferred types is hard diff --git a/src/dev/build/tasks/fetch_agent_versions_list.ts b/src/dev/build/tasks/fetch_agent_versions_list.ts index fc5e90001bca40..2dc916e734429a 100644 --- a/src/dev/build/tasks/fetch_agent_versions_list.ts +++ b/src/dev/build/tasks/fetch_agent_versions_list.ts @@ -72,7 +72,7 @@ export const FetchAgentVersionsList: Task = { const versionsList = await getAvailableVersions(log); const AGENT_VERSION_BUILD_FILE = 'x-pack/plugins/fleet/target/agent_versions_list.json'; - if (versionsList !== []) { + if (versionsList.length !== 0) { log.info(`Writing versions list to ${AGENT_VERSION_BUILD_FILE}`); await write( build.resolvePath(AGENT_VERSION_BUILD_FILE), diff --git a/src/dev/code_coverage/ingest_coverage/__tests__/mocks/team_assign_mock.txt b/src/dev/code_coverage/ingest_coverage/__tests__/mocks/team_assign_mock.txt index 15d3eb058bcf3a..b04178ec71c6f3 100644 --- a/src/dev/code_coverage/ingest_coverage/__tests__/mocks/team_assign_mock.txt +++ b/src/dev/code_coverage/ingest_coverage/__tests__/mocks/team_assign_mock.txt @@ -61,9 +61,6 @@ x-pack/plugins/lens/public/datatable_visualization/expression.tsx kibana-app x-pack/plugins/lens/public/datatable_visualization/index.ts kibana-app x-pack/plugins/lens/public/datatable_visualization/visualization.test.tsx kibana-app x-pack/plugins/lens/public/datatable_visualization/visualization.tsx kibana-app -x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx kibana-app -x-pack/plugins/lens/public/debounced_component/debounced_component.tsx kibana-app -x-pack/plugins/lens/public/debounced_component/index.ts kibana-app x-pack/plugins/lens/public/drag_drop/drag_drop.test.tsx kibana-app x-pack/plugins/lens/public/drag_drop/drag_drop.tsx kibana-app x-pack/plugins/lens/public/drag_drop/index.ts kibana-app diff --git a/src/plugins/chart_expressions/expression_legacy_metric/public/__stories__/metric_renderer.stories.tsx b/src/plugins/chart_expressions/expression_legacy_metric/public/__stories__/metric_renderer.stories.tsx index ba2835806f4f51..72e52ef303f4c2 100644 --- a/src/plugins/chart_expressions/expression_legacy_metric/public/__stories__/metric_renderer.stories.tsx +++ b/src/plugins/chart_expressions/expression_legacy_metric/public/__stories__/metric_renderer.stories.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; import { from } from 'rxjs'; import { ExpressionValueVisDimension } from '@kbn/visualizations-plugin/common'; -import { Datatable, DatatableColumn } from '@kbn/expressions-plugin/common'; +import { Datatable, DatatableColumn, TextAlignment } from '@kbn/expressions-plugin/common'; import { Render } from '@kbn/presentation-util-plugin/public/__stories__'; import { ColorMode, CustomPaletteState } from '@kbn/charts-plugin/common'; import { getFormatService } from '../__mocks__/format_service'; @@ -209,7 +209,11 @@ storiesOf('renderers/visMetric', module) }, labels: { show: false, - style: { spec: { fontSize: '60px', align: 'left' }, type: 'style', css: '' }, + style: { + spec: { fontSize: '60px', textAlign: TextAlignment.LEFT }, + type: 'style', + css: '', + }, position: LabelPosition.TOP, }, }, diff --git a/src/plugins/chart_expressions/expression_legacy_metric/public/components/with_auto_scale.tsx b/src/plugins/chart_expressions/expression_legacy_metric/public/components/with_auto_scale.tsx index 2f67094fdc4edc..36093abaddf5a4 100644 --- a/src/plugins/chart_expressions/expression_legacy_metric/public/components/with_auto_scale.tsx +++ b/src/plugins/chart_expressions/expression_legacy_metric/public/components/with_auto_scale.tsx @@ -63,10 +63,13 @@ function hasAutoscaleProps(props: T): props is T & AutoScaleProps { return false; } -function getWrappedComponentProps(props: T) { +function getWrappedComponentProps(props: T): T { if (hasAutoscaleProps(props)) { - const { autoScaleParams, renderComplete, ...rest } = props; - return rest; + return { + ...props, + autoScaleParams: undefined, + renderComplete: undefined, + }; } return props; @@ -132,7 +135,7 @@ export function withAutoScale(WrappedComponent: ComponentType) { : {}), }} > - + ); diff --git a/src/plugins/data_view_management/public/components/test_utils.tsx b/src/plugins/data_view_management/public/components/test_utils.tsx index 8970595513e043..4a7fec97e32810 100644 --- a/src/plugins/data_view_management/public/components/test_utils.tsx +++ b/src/plugins/data_view_management/public/components/test_utils.tsx @@ -21,6 +21,7 @@ export function createComponentWithContext>( services: PropTypes.object, }; + // @ts-expect-error upgrade typescript v4.9.5 return shallow(, { context: { services: mockedContext, diff --git a/src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts b/src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts index a96287a61d0f38..cb777aecb53b8e 100644 --- a/src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts +++ b/src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts @@ -65,6 +65,7 @@ export interface EmbeddableFactory< */ readonly isEditable: () => Promise; + // @ts-expect-error upgrade typescript v4.9.5 readonly savedObjectMetaData?: SavedObjectMetaData; /** diff --git a/src/plugins/embeddable/public/registry/saved_object_to_panel_methods.ts b/src/plugins/embeddable/public/registry/saved_object_to_panel_methods.ts index 2d996666d40426..1647cb6215533d 100644 --- a/src/plugins/embeddable/public/registry/saved_object_to_panel_methods.ts +++ b/src/plugins/embeddable/public/registry/saved_object_to_panel_methods.ts @@ -9,6 +9,7 @@ import { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common'; type SavedObjectToPanelMethod = ( + // @ts-expect-error upgrade typescript v4.9.5 savedObject: SavedObjectCommon ) => { savedObjectId: string } | Partial; diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/use_field.tsx b/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/use_field.tsx index 86af10f08cc23a..d66348d39feae9 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/use_field.tsx +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/use_field.tsx @@ -13,6 +13,7 @@ import { useFieldFromProps } from '../hooks'; export interface Props { path: string; + // @ts-expect-error upgrade typescript v4.9.5 config?: FieldConfig; defaultValue?: T; component?: FunctionComponent; diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts index 6ce084cb750b44..324a2ea1255a8d 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts @@ -31,8 +31,10 @@ const errorsToString = (errors: ValidationError[]): string[] | null => { }; export const useField = ( + // @ts-expect-error upgrade typescript v4.9.5 form: FormHook, path: string, + // @ts-expect-error upgrade typescript v4.9.5 config: FieldConfig & InternalFieldConfig, valueChangeListener?: (value: I) => void, errorChangeListener?: (errors: string[] | null) => void, @@ -231,7 +233,7 @@ export const useField = ( // -- helpers const doByPassValidation = ({ type: validationType, - isBlocking, + isBlocking, // @ts-expect-error upgrade typescript v4.9.5 }: ValidationConfig) => { if (validationType !== undefined && validationType !== validationTypeToValidate) { return true; @@ -246,6 +248,7 @@ export const useField = ( const enhanceValidationError = ( validationError: ValidationError, + // @ts-expect-error upgrade typescript v4.9.5 validation: ValidationConfig, validationType: string ) => ({ @@ -275,6 +278,7 @@ export const useField = ( inflightValidation.current = validator({ value: valueToValidate, errors: validationErrors, + // @ts-expect-error upgrade typescript v4.9.5 form: { getFormData, getFields }, formData, path, @@ -318,6 +322,7 @@ export const useField = ( const validationResult = validator({ value: valueToValidate, errors: validationErrors, + // @ts-expect-error upgrade typescript v4.9.5 form: { getFormData, getFields }, formData, path, diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field_from_props.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field_from_props.ts index a3d36fd534b5db..4fbe65931b984d 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field_from_props.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field_from_props.ts @@ -21,6 +21,7 @@ import { useField, InternalFieldConfig } from './use_field'; export const useFieldFromProps = ( props: UseFieldProps ): { field: FieldHook; propsToForward: { [x: string]: unknown } } => { + // @ts-expect-error upgrade typescript v4.9.5 const form = useFormContext(); const { getFieldDefaultValue, __readFieldConfigFromSchema, __updateDefaultValueAt } = form; @@ -71,6 +72,7 @@ export const useFieldFromProps = ( return value === undefined ? ('' as unknown as T) : value; }, [defaultValue, path, config, readDefaultValueOnForm, getFieldDefaultValue]); + // @ts-expect-error upgrade typescript v4.9.5 const fieldConfig = useMemo & InternalFieldConfig>( () => ({ ...config, diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/types.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/types.ts index 22b9fdc6229a77..a7cc46717b1792 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/types.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/types.ts @@ -101,6 +101,7 @@ export interface FormHook InternalFieldType = FieldType >( fieldPath: string + // @ts-expect-error upgrade typescript v4.9.5 ) => FieldConfig | undefined; __getFormDefaultValue: () => I | undefined; __getFieldsRemoved: () => FieldsMap; diff --git a/src/plugins/expressions/common/execution/execution_contract.ts b/src/plugins/expressions/common/execution/execution_contract.ts index 34e11ad4c4948e..50dda43661367f 100644 --- a/src/plugins/expressions/common/execution/execution_contract.ts +++ b/src/plugins/expressions/common/execution/execution_contract.ts @@ -17,7 +17,11 @@ import { ExpressionAstExpression } from '../ast'; * `ExecutionContract` is a wrapper around `Execution` class. It provides the * same functionality but does not expose Expressions plugin internals. */ -export class ExecutionContract { +export class ExecutionContract< + Input = unknown, + Output = unknown, + InspectorAdapters extends Adapters = object +> { public get isPending(): boolean { const { state, result } = this.execution.state.get(); const finished = state === 'error' || (state === 'result' && !result?.partial); diff --git a/src/plugins/files/server/routes/file_kind/enhance_router.ts b/src/plugins/files/server/routes/file_kind/enhance_router.ts index 87be1c4e08ea05..d1757ab51e2cda 100644 --- a/src/plugins/files/server/routes/file_kind/enhance_router.ts +++ b/src/plugins/files/server/routes/file_kind/enhance_router.ts @@ -26,6 +26,7 @@ export function enhanceRouter({ router, fileKind }: Args): FileKindRouter { const handlerWrapper: (handler: FileKindHandler) => FileKindHandler = (handler) => async (ctx, req, res) => { return handler( + // @ts-expect-error upgrade typescript v4.9.5 Object.create(ctx, { fileKind: { value: fileKind, enumerable: true, writeable: false } }), req, res diff --git a/src/plugins/files/server/routes/types.ts b/src/plugins/files/server/routes/types.ts index 1c803c71b78c06..58ddd8ca803c4f 100644 --- a/src/plugins/files/server/routes/types.ts +++ b/src/plugins/files/server/routes/types.ts @@ -41,6 +41,7 @@ export type FilesRequestHandler< Method extends RouteMethod = any > = RequestHandler; +// @ts-expect-error upgrade typescript v4.9.5 export type AsyncResponse = Promise>; export type CreateHandler = FilesRequestHandler< diff --git a/src/plugins/interactive_setup/public/use_form.ts b/src/plugins/interactive_setup/public/use_form.ts index 47768400dd7755..bc3ae7caf360e7 100644 --- a/src/plugins/interactive_setup/public/use_form.ts +++ b/src/plugins/interactive_setup/public/use_form.ts @@ -128,7 +128,7 @@ export function useFormState({ const [touched, setTouched] = useState>({}); const [submitCount, setSubmitCount] = useState(0); - async function validateFormFn(formValues: Values): Promise; + async function validateFormFn(formValues: Values): Promise>; async function validateFormFn(formValues: undefined): Promise; async function validateFormFn(formValues: Values | undefined) { // Allows resetting `useAsyncFn` state diff --git a/src/plugins/presentation_util/public/services/create/provider.tsx b/src/plugins/presentation_util/public/services/create/provider.tsx index 3271dc52fd9d08..c95231c6826d63 100644 --- a/src/plugins/presentation_util/public/services/create/provider.tsx +++ b/src/plugins/presentation_util/public/services/create/provider.tsx @@ -18,6 +18,7 @@ import { PluginServiceFactory } from './factory'; */ export type PluginServiceProviders = { [K in keyof Services]: PluginServiceProvider< + // @ts-expect-error upgrade typescript v4.9.5 Services[K], StartParameters, Services, diff --git a/src/plugins/unified_histogram/public/layout/layout.tsx b/src/plugins/unified_histogram/public/layout/layout.tsx index 7d1cb9f5e90647..aaeb67b15b1018 100644 --- a/src/plugins/unified_histogram/public/layout/layout.tsx +++ b/src/plugins/unified_histogram/public/layout/layout.tsx @@ -350,7 +350,8 @@ export const UnifiedHistogramLayout = ({ {React.isValidElement(children) - ? React.cloneElement(children, { isChartAvailable }) + ? // @ts-expect-error upgrade typescript v4.9.5 + React.cloneElement(children, { isChartAvailable }) : children} ({ createGridColumns: jest.fn(() => []), @@ -107,7 +108,8 @@ describe('TableVisBasic', () => { undefined ); - const { onSort } = comp.find('EuiDataGrid').prop('sorting'); + const { onSort } = comp.find('EuiDataGrid').prop('sorting')!; + // sort the first column onSort([{ id: 'first', direction: 'asc' }]); expect(uiStateProps.setSort).toHaveBeenCalledWith({ columnIndex: 0, direction: 'asc' }); diff --git a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/percentile.ts b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/percentile.ts index 163d42b976b3a2..1cc36538798029 100644 --- a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/percentile.ts +++ b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/percentile.ts @@ -49,18 +49,20 @@ export const convertToPercentileColumn = ( return null; } const commonColumnParams = createColumn(series, metric, field, { reducedTimeRange, timeShift }); + const meta: PercentileColumn['meta'] = + index !== undefined + ? { + reference: `${metric.id}.${index}`, + ...commonColumnParams.meta, + } + : commonColumnParams.meta; + return { operationType: 'percentile', sourceField: field.name, ...commonColumnParams, params: { ...params, ...getFormat(series) }, - meta: - index !== undefined - ? { - reference: `${metric.id}.${index}`, - ...commonColumnParams.meta, - } - : commonColumnParams.meta, + meta, }; }; diff --git a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/percentile_rank.ts b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/percentile_rank.ts index 31374067be7c0b..27f9c021c56cae 100644 --- a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/percentile_rank.ts +++ b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/convert/percentile_rank.ts @@ -19,6 +19,7 @@ import { Column, PercentileRanksColumnWithExtendedMeta, CommonColumnConverterArgs, + PercentileColumn, } from './types'; export const isPercentileRanksColumnWithMeta = ( @@ -56,18 +57,19 @@ export const convertToPercentileRankColumn = ( } const commonColumnParams = createColumn(series, metric, field, { reducedTimeRange, timeShift }); + const meta: PercentileColumn['meta'] = + index !== undefined + ? { + reference: `${metric.id}.${index}`, + ...commonColumnParams.meta, + } + : commonColumnParams.meta; return { operationType: 'percentile_rank', sourceField: field.name, ...commonColumnParams, params: { ...params, ...getFormat(series) }, - meta: - index !== undefined - ? { - reference: `${metric.id}.${index}`, - ...commonColumnParams.meta, - } - : commonColumnParams.meta, + meta, }; }; diff --git a/src/plugins/visualizations/public/convert_to_lens/schemas.ts b/src/plugins/visualizations/public/convert_to_lens/schemas.ts index 886be04bb654ac..cd0c3b25604671 100644 --- a/src/plugins/visualizations/public/convert_to_lens/schemas.ts +++ b/src/plugins/visualizations/public/convert_to_lens/schemas.ts @@ -8,7 +8,7 @@ import type { DataView } from '@kbn/data-views-plugin/common'; import { IAggConfig, METRIC_TYPES, TimefilterContract } from '@kbn/data-plugin/public'; -import { AggBasedColumn, PercentageModeConfig, SchemaConfig } from '../../common'; +import { AggBasedColumn, PercentageModeConfig, SchemaConfig, VisParams } from '../../common'; import { convertMetricToColumns } from '../../common/convert_to_lens/lib/metrics'; import { getAggIdAndValue, @@ -133,8 +133,8 @@ const createLayer = ( }; }; -export const getColumnsFromVis = ( - vis: Vis, +export const getColumnsFromVis = ( + vis: Vis, timefilter: TimefilterContract, dataView: DataView, { diff --git a/src/plugins/visualizations/public/types.ts b/src/plugins/visualizations/public/types.ts index f00777c5ef957d..29c8ca2e1b8268 100644 --- a/src/plugins/visualizations/public/types.ts +++ b/src/plugins/visualizations/public/types.ts @@ -80,7 +80,7 @@ export interface VisToExpressionAstParams { abortSignal?: AbortSignal; } -export type VisToExpressionAst = ( +export type VisToExpressionAst = ( vis: Vis, params: VisToExpressionAstParams ) => Promise | ExpressionAstExpression; diff --git a/src/plugins/visualizations/public/vis.ts b/src/plugins/visualizations/public/vis.ts index d1dbe44d52945b..89e7282c4449e0 100644 --- a/src/plugins/visualizations/public/vis.ts +++ b/src/plugins/visualizations/public/vis.ts @@ -57,7 +57,7 @@ const getSearchSource = async (inputSearchSource: ISearchSource, savedSearchId?: type PartialVisState = Assign }>; -export class Vis { +export class Vis { public readonly type: BaseVisType; public readonly id?: string; public title: string = ''; diff --git a/src/plugins/visualizations/public/vis_async.ts b/src/plugins/visualizations/public/vis_async.ts index 0996e5da48c367..4e295596b1611f 100644 --- a/src/plugins/visualizations/public/vis_async.ts +++ b/src/plugins/visualizations/public/vis_async.ts @@ -9,7 +9,7 @@ import type { SerializedVis } from './vis'; import type { VisParams } from '../common'; -export const createVisAsync = async ( +export const createVisAsync = async ( visType: string, visState: SerializedVis = {} as any ) => { diff --git a/src/plugins/visualizations/public/vis_editors_registry.ts b/src/plugins/visualizations/public/vis_editors_registry.ts index 627490f3f99bf5..d03f092d51baa3 100644 --- a/src/plugins/visualizations/public/vis_editors_registry.ts +++ b/src/plugins/visualizations/public/vis_editors_registry.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { VisParams } from '../common'; import { VisEditorConstructor } from './visualize_app/types'; const DEFAULT_NAME = 'default'; @@ -17,7 +18,10 @@ export const createVisEditorsRegistry = () => { registerDefault: (editor: VisEditorConstructor) => { map.set(DEFAULT_NAME, editor); }, - register: (name: string, editor: VisEditorConstructor) => { + register: ( + name: string, + editor: VisEditorConstructor + ) => { if (name) { map.set(name, editor); } diff --git a/src/plugins/visualizations/public/vis_schemas.ts b/src/plugins/visualizations/public/vis_schemas.ts index cd8bd9bc386a86..72cee5a3ce06be 100644 --- a/src/plugins/visualizations/public/vis_schemas.ts +++ b/src/plugins/visualizations/public/vis_schemas.ts @@ -14,7 +14,7 @@ import { } from '@kbn/data-plugin/common'; import { search } from '@kbn/data-plugin/public'; import { Vis, VisToExpressionAstParams } from './types'; -import { SchemaConfig } from '../common/types'; +import { SchemaConfig, VisParams } from '../common/types'; import { convertToSchemaConfig } from '../common'; const { isDateHistogramBucketAggConfig } = search.aggs; @@ -76,7 +76,7 @@ const createSchemaConfig = ( return { ...convertToSchemaConfig(updatedAgg), accessor }; }; -export const getVisSchemas = ( +export const getVisSchemas = ( vis: Vis, params: VisToExpressionAstParams ): Schemas => { diff --git a/src/plugins/visualizations/public/vis_types/base_vis_type.ts b/src/plugins/visualizations/public/vis_types/base_vis_type.ts index 2625781c264296..26801421159b31 100644 --- a/src/plugins/visualizations/public/vis_types/base_vis_type.ts +++ b/src/plugins/visualizations/public/vis_types/base_vis_type.ts @@ -21,7 +21,7 @@ const defaultOptions: VisTypeOptions = { hierarchicalData: false, // we should get rid of this i guess ? }; -export class BaseVisType { +export class BaseVisType { public readonly name; public readonly title; public readonly description; diff --git a/src/plugins/visualizations/public/vis_types/types.ts b/src/plugins/visualizations/public/vis_types/types.ts index 90f64276adf763..2f689cb81aee02 100644 --- a/src/plugins/visualizations/public/vis_types/types.ts +++ b/src/plugins/visualizations/public/vis_types/types.ts @@ -79,7 +79,7 @@ interface CustomEditorConfig { * A visualization type definition representing a spec of one specific type of "classical" * visualizations (i.e. not Lens visualizations). */ -export interface VisTypeDefinition { +export interface VisTypeDefinition { /** * Visualization unique name */ diff --git a/src/plugins/visualizations/public/vis_types/types_service.ts b/src/plugins/visualizations/public/vis_types/types_service.ts index 4b20dcc1569c5e..282c9b65bfe941 100644 --- a/src/plugins/visualizations/public/vis_types/types_service.ts +++ b/src/plugins/visualizations/public/vis_types/types_service.ts @@ -10,6 +10,7 @@ import { visTypeAliasRegistry, VisTypeAlias } from './vis_type_alias_registry'; import { BaseVisType } from './base_vis_type'; import { VisTypeDefinition } from './types'; import { VisGroups } from './vis_groups_enum'; +import { VisParams } from '../../common'; /** * Vis Types Service @@ -19,7 +20,9 @@ import { VisGroups } from './vis_groups_enum'; export class TypesService { private types: Record> = {}; - private registerVisualization(visDefinition: BaseVisType) { + private registerVisualization( + visDefinition: BaseVisType + ) { if (this.types[visDefinition.name]) { throw new Error('type already exists!'); } @@ -32,7 +35,9 @@ export class TypesService { * registers a visualization type * @param config - visualization type definition */ - createBaseVisualization: (config: VisTypeDefinition): void => { + createBaseVisualization: ( + config: VisTypeDefinition + ): void => { const vis = new BaseVisType(config); this.registerVisualization(vis); }, @@ -51,7 +56,9 @@ export class TypesService { * returns specific visualization or undefined if not found * @param {string} visualization - id of visualization to return */ - get: (visualization: string): BaseVisType | undefined => { + get: ( + visualization: string + ): BaseVisType | undefined => { return this.types[visualization]; }, /** diff --git a/src/plugins/visualizations/public/visualize_app/types.ts b/src/plugins/visualizations/public/visualize_app/types.ts index abc55e3e671fec..7e91cd4ce2bd01 100644 --- a/src/plugins/visualizations/public/visualize_app/types.ts +++ b/src/plugins/visualizations/public/visualize_app/types.ts @@ -137,7 +137,7 @@ export type SavedVisInstance = VisInstance; export type ByValueVisInstance = VisInstance; export type VisualizeEditorVisInstance = SavedVisInstance | ByValueVisInstance; -export type VisEditorConstructor = new ( +export type VisEditorConstructor = new ( element: HTMLElement, vis: Vis, eventEmitter: EventEmitter, diff --git a/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx b/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx index 208eefe941528c..46100397e26653 100644 --- a/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx +++ b/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx @@ -10,6 +10,7 @@ import React from 'react'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TypesStart, BaseVisType, VisGroups } from '../../vis_types'; import { AggBasedSelection } from './agg_based_selection'; +import { VisParams } from '../../../common'; describe('AggBasedSelection', () => { const defaultVisTypeParams = { @@ -47,7 +48,7 @@ describe('AggBasedSelection', () => { ] as BaseVisType[]; const visTypes: TypesStart = { - get(id: string): BaseVisType { + get(id: string): BaseVisType { return _visTypes.find((vis) => vis.name === id) as unknown as BaseVisType; }, all: () => _visTypes, diff --git a/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx b/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx index a9a21446e06a20..33955b6f2995f2 100644 --- a/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx +++ b/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx @@ -11,6 +11,7 @@ import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TypesStart, BaseVisType, VisGroups } from '../../vis_types'; import { GroupSelection } from './group_selection'; import { DocLinksStart } from '@kbn/core/public'; +import { VisParams } from '../../../common'; describe('GroupSelection', () => { const defaultVisTypeParams = { @@ -61,7 +62,7 @@ describe('GroupSelection', () => { const visTypesRegistry = (visTypes: BaseVisType[]): TypesStart => { return { - get(id: string): BaseVisType { + get(id: string): BaseVisType { return visTypes.find((vis) => vis.name === id) as unknown as BaseVisType; }, all: () => { diff --git a/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx index 0db5f66cc5c925..c2f9aed1ec0cca 100644 --- a/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx @@ -13,6 +13,7 @@ import NewVisModal from './new_vis_modal'; import { ApplicationStart, DocLinksStart } from '@kbn/core/public'; import { embeddablePluginMock } from '@kbn/embeddable-plugin/public/mocks'; import { contentManagementMock } from '@kbn/content-management-plugin/public/mocks'; +import { VisParams } from '../../common'; describe('NewVisModal', () => { const defaultVisTypeParams = { @@ -61,7 +62,7 @@ describe('NewVisModal', () => { }, ] as BaseVisType[]; const visTypes: TypesStart = { - get(id: string): BaseVisType { + get(id: string): BaseVisType { return _visTypes.find((vis) => vis.name === id) as unknown as BaseVisType; }, all: () => _visTypes, diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index 72b64f7b0aa454..b68ff285076e3f 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -39,6 +39,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) { await appsMenu.clickLink(title); return browser.execute(() => { if (!('__RENDERING_SESSION__' in window)) { + // @ts-expect-error upgrade typescript v4.9.5 window.__RENDERING_SESSION__ = []; } diff --git a/x-pack/packages/ml/cancellable_search/src/use_cancellable_search.ts b/x-pack/packages/ml/cancellable_search/src/use_cancellable_search.ts index 78e7e4a17b1fae..4f0d75fdede247 100644 --- a/x-pack/packages/ml/cancellable_search/src/use_cancellable_search.ts +++ b/x-pack/packages/ml/cancellable_search/src/use_cancellable_search.ts @@ -31,6 +31,7 @@ export function useCancellableSearch(data: DataPublicPluginStart) { ): Promise => { return new Promise((resolve, reject) => { data.search + // @ts-expect-error upgrade typescript v4.9.5 .search(requestBody, { abortSignal: abortController.current.signal, ...options, diff --git a/x-pack/packages/ml/date_picker/src/components/full_time_range_selector.test.tsx b/x-pack/packages/ml/date_picker/src/components/full_time_range_selector.test.tsx index 9307a24d88359a..a217bbc4fb2cf0 100644 --- a/x-pack/packages/ml/date_picker/src/components/full_time_range_selector.test.tsx +++ b/x-pack/packages/ml/date_picker/src/components/full_time_range_selector.test.tsx @@ -70,6 +70,7 @@ describe('FullTimeRangeSelector', () => { const { getByText } = render( + {/* @ts-expect-error upgrade typescript v4.9.5*/} @@ -98,6 +99,7 @@ describe('FullTimeRangeSelector', () => { const { getByText } = render( + {/* @ts-expect-error upgrade typescript v4.9.5*/} diff --git a/x-pack/plugins/aiops/public/hooks/use_cancellable_search.ts b/x-pack/plugins/aiops/public/hooks/use_cancellable_search.ts index 7d905fe2894eae..8a828f388c2f23 100644 --- a/x-pack/plugins/aiops/public/hooks/use_cancellable_search.ts +++ b/x-pack/plugins/aiops/public/hooks/use_cancellable_search.ts @@ -21,6 +21,7 @@ export function useCancellableSearch() { ): Promise => { return new Promise((resolve, reject) => { data.search + // @ts-expect-error upgrade typescript v4.9.5 .search(requestBody, { abortSignal: abortController.current.signal, }) diff --git a/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.ts index 11cd4d5f9e3284..b9e4dedf4d1330 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.ts @@ -195,6 +195,7 @@ export async function createRule( { legacyId, actionsWithRefs: actions, + // @ts-expect-error upgrade typescript v4.9.5 paramsWithRefs: updatedParams, } ); diff --git a/x-pack/plugins/alerting/server/application/rule/methods/resolve/types/resolved_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/resolve/types/resolved_rule.ts index d9d0c3f0c5e8f9..a5aef7d2aaf4db 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/resolve/types/resolved_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/resolve/types/resolved_rule.ts @@ -6,4 +6,5 @@ */ import type { Rule } from '../../../types'; +// @ts-expect-error upgrade typescript v4.9.5 export type ResolvedRule = Rule & { outcome: string; alias_target_id?: string }; diff --git a/x-pack/plugins/alerting/server/routes/get_rule.test.ts b/x-pack/plugins/alerting/server/routes/get_rule.test.ts index a672de9cbf320d..864a848b8ffa8d 100644 --- a/x-pack/plugins/alerting/server/routes/get_rule.test.ts +++ b/x-pack/plugins/alerting/server/routes/get_rule.test.ts @@ -48,6 +48,7 @@ describe('getRuleRoute', () => { alertsFilter: { query: { kql: 'name:test', + // @ts-expect-error upgrade typescript v4.9.5 dsl: '{"must": {"term": { "name": "test" }}}', filters: [], }, diff --git a/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.test.ts b/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.test.ts index 826ee952a6bb65..4ad0dc817fbbe4 100644 --- a/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.test.ts +++ b/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.test.ts @@ -43,6 +43,7 @@ const sampleRule: SanitizedRule & { activeSnoozes?: string[] } = notifyWhen: 'onThrottleInterval', throttle: '1m', }, + // @ts-expect-error upgrade typescript v4.9.5 alertsFilter: { query: { kql: 'test:1', dsl: '{}', filters: [] } }, }, ], diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.test.ts index e952a72ec38590..512436475a3951 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.test.ts @@ -55,6 +55,7 @@ describe('createRuleRoute', () => { alertsFilter: { query: { kql: 'name:test', + // @ts-expect-error upgrade typescript v4.9.5 dsl: '{"must": {"term": { "name": "test" }}}', filters: [], }, diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/server/pointseries/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/server/pointseries/index.ts index 195de0a38a5818..957dd1bf3782e0 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/server/pointseries/index.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/server/pointseries/index.ts @@ -28,7 +28,7 @@ const columnExists = (cols: string[], colName: string): boolean => cols.includes(unquoteString(colName)); function keysOf(obj: T): K[] { - return Object.keys(obj) as K[]; + return Object.keys(obj as any) as K[]; } type Arguments = { [key in PointSeriesColumnName]: string | null }; diff --git a/x-pack/plugins/canvas/server/templates/status_report.ts b/x-pack/plugins/canvas/server/templates/status_report.ts index 94f05c371ff98a..2cfa1be75bfec7 100644 --- a/x-pack/plugins/canvas/server/templates/status_report.ts +++ b/x-pack/plugins/canvas/server/templates/status_report.ts @@ -652,6 +652,7 @@ export const status: CanvasTemplate = { }, expression: 'demodata\n| dropdownControl valueColumn="project" filterColumn="project"\n| render', + // @ts-expect-error upgrade typescript v4.9.5 filter: '', }, ], diff --git a/x-pack/plugins/canvas/server/templates/summary_report.ts b/x-pack/plugins/canvas/server/templates/summary_report.ts index 67cbe0bf6a1e84..3bba179d35efd3 100644 --- a/x-pack/plugins/canvas/server/templates/summary_report.ts +++ b/x-pack/plugins/canvas/server/templates/summary_report.ts @@ -324,6 +324,7 @@ export const summary: CanvasTemplate = { }, expression: 'timefilterControl compact=true column="@timestamp"\n| render css=".canvasTimePickerPopover__button {\n border: none !important;\n}"', + // @ts-expect-error upgrade typescript v4.9.5 filter: 'timefilter from="now-14d" to=now column=@timestamp', }, { diff --git a/x-pack/plugins/canvas/types/arguments.ts b/x-pack/plugins/canvas/types/arguments.ts index 0ecc696165919c..4269c62d352ba9 100644 --- a/x-pack/plugins/canvas/types/arguments.ts +++ b/x-pack/plugins/canvas/types/arguments.ts @@ -38,6 +38,7 @@ export interface ArgumentSpec { domNode: HTMLElement, config: ArgumentConfig, handlers: ArgumentHandlers, + // @ts-expect-error upgrade typescript v4.9.5 onMount: (ref: UpdatePropsRef | null) => void ) => void; /** @@ -48,6 +49,7 @@ export interface ArgumentSpec { domNode: HTMLElement, config: ArgumentConfig, handlers: ArgumentHandlers, + // @ts-expect-error upgrade typescript v4.9.5 onMount: (ref: UpdatePropsRef | null) => void ) => void; } diff --git a/x-pack/plugins/canvas/types/functions.ts b/x-pack/plugins/canvas/types/functions.ts index 5dd57c00cc4990..4c07add1e051e9 100644 --- a/x-pack/plugins/canvas/types/functions.ts +++ b/x-pack/plugins/canvas/types/functions.ts @@ -72,6 +72,7 @@ import type { initFunctions as initClientFunctions } from '../public/functions'; */ // prettier-ignore export type ExpressionFunctionFactory = + // @ts-expect-error upgrade typescript v4.9.5 () => ExpressionFunctionDefinition /** @@ -83,6 +84,7 @@ export type ExpressionFunctionFactory = FnFactory extends ExpressionFunctionFactory ? + // @ts-expect-error upgrade typescript v4.9.5 ExpressionFunctionDefinition> : never; diff --git a/x-pack/plugins/cases/public/api/utils.ts b/x-pack/plugins/cases/public/api/utils.ts index 6bb1c23266d651..99e6ceb6f312c0 100644 --- a/x-pack/plugins/cases/public/api/utils.ts +++ b/x-pack/plugins/cases/public/api/utils.ts @@ -39,7 +39,7 @@ export const convertArrayToCamelCase = (arrayOfSnakes: unknown[]): unknown[] => }, []); export const convertToCamelCase = (obj: T): U => - Object.entries(obj).reduce((acc, [key, value]) => { + Object.entries(obj as never).reduce((acc, [key, value]) => { if (isArray(value)) { set(acc, camelCase(key), convertArrayToCamelCase(value)); } else if (isObject(value)) { diff --git a/x-pack/plugins/cases/public/components/case_view/components/user_list.test.tsx b/x-pack/plugins/cases/public/components/case_view/components/user_list.test.tsx index bcfb70cc2fe8ca..3da3cd8add20d5 100644 --- a/x-pack/plugins/cases/public/components/case_view/components/user_list.test.tsx +++ b/x-pack/plugins/cases/public/components/case_view/components/user_list.test.tsx @@ -147,6 +147,7 @@ describe('UserList ', () => { username: null, email: null, full_name: null, + // @ts-expect-error upgrade typescript v4.9.5 uid: null, }, }, diff --git a/x-pack/plugins/data_visualizer/public/application/data_drift/use_data_drift_result.ts b/x-pack/plugins/data_visualizer/public/application/data_drift/use_data_drift_result.ts index 05f24bdcb7b683..d1873df4d66716 100644 --- a/x-pack/plugins/data_visualizer/public/application/data_drift/use_data_drift_result.ts +++ b/x-pack/plugins/data_visualizer/public/application/data_drift/use_data_drift_result.ts @@ -509,7 +509,9 @@ const fetchComparisonDriftedData = async ({ ); fieldsWithNoOverlap.forEach((field) => { + // @ts-expect-error upgrade typescript v4.9.5 if (driftedResp.aggregations) { + // @ts-expect-error upgrade typescript v4.9.5 driftedResp.aggregations[`${field}_ks_test`] = { // Setting -Infinity to represent astronomically small number // which would be represented as < 0.000001 in table @@ -801,6 +803,7 @@ export const useFetchDataComparisonResult = ( randomSamplerWrapper, asyncFetchFn: (chunkedFields) => + // @ts-expect-error upgrade typescript v4.9.5 fetchReferenceBaselineData({ dataSearch, baseRequest: baselineRequest, @@ -862,6 +865,7 @@ export const useFetchDataComparisonResult = ( fields, randomSamplerWrapper: prodRandomSamplerWrapper, + // @ts-expect-error upgrade typescript v4.9.5 asyncFetchFn: (chunkedFields: DataDriftField[]) => fetchComparisonDriftedData({ dataSearch, @@ -904,11 +908,14 @@ export const useFetchDataComparisonResult = ( fields, randomSamplerWrapper, + // @ts-expect-error upgrade typescript v4.9.5 asyncFetchFn: (chunkedFields: DataDriftField[]) => fetchHistogramData({ dataSearch, baseRequest: referenceHistogramRequest, + // @ts-expect-error upgrade typescript v4.9.5 baselineResponseAggs, + // @ts-expect-error upgrade typescript v4.9.5 driftedRespAggs, fields: chunkedFields, randomSamplerWrapper, @@ -946,11 +953,14 @@ export const useFetchDataComparisonResult = ( fields, randomSamplerWrapper, + // @ts-expect-error upgrade typescript v4.9.5 asyncFetchFn: (chunkedFields: DataDriftField[]) => fetchHistogramData({ dataSearch, baseRequest: comparisonHistogramRequest, + // @ts-expect-error upgrade typescript v4.9.5 baselineResponseAggs, + // @ts-expect-error upgrade typescript v4.9.5 driftedRespAggs, fields: chunkedFields, randomSamplerWrapper, @@ -972,30 +982,42 @@ export const useFetchDataComparisonResult = ( for (const { field, type, secondaryType } of fields) { if ( type === DATA_COMPARISON_TYPE.NUMERIC && + // @ts-expect-error upgrade typescript v4.9.5 driftedRespAggs[`${field}_ks_test`] && + // @ts-expect-error upgrade typescript v4.9.5 referenceHistogramRespAggs[`${field}_histogram`] && + // @ts-expect-error upgrade typescript v4.9.5 comparisonHistogramRespAggs[`${field}_histogram`] ) { data[field] = { secondaryType, type: DATA_COMPARISON_TYPE.NUMERIC, + // @ts-expect-error upgrade typescript v4.9.5 pValue: driftedRespAggs[`${field}_ks_test`].two_sided, + // @ts-expect-error upgrade typescript v4.9.5 referenceHistogram: referenceHistogramRespAggs[`${field}_histogram`].buckets, + // @ts-expect-error upgrade typescript v4.9.5 comparisonHistogram: comparisonHistogramRespAggs[`${field}_histogram`].buckets, }; } if ( type === DATA_COMPARISON_TYPE.CATEGORICAL && + // @ts-expect-error upgrade typescript v4.9.5 driftedRespAggs[`${field}_terms`] && + // @ts-expect-error upgrade typescript v4.9.5 baselineResponseAggs[`${field}_terms`] ) { data[field] = { secondaryType, type: DATA_COMPARISON_TYPE.CATEGORICAL, + // @ts-expect-error upgrade typescript v4.9.5 driftedTerms: driftedRespAggs[`${field}_terms`].buckets ?? [], + // @ts-expect-error upgrade typescript v4.9.5 driftedSumOtherDocCount: driftedRespAggs[`${field}_terms`].sum_other_doc_count, + // @ts-expect-error upgrade typescript v4.9.5 baselineTerms: baselineResponseAggs[`${field}_terms`].buckets ?? [], baselineSumOtherDocCount: + // @ts-expect-error upgrade typescript v4.9.5 baselineResponseAggs[`${field}_terms`].sum_other_doc_count, }; } diff --git a/x-pack/plugins/ecs_data_quality_dashboard/server/lib/build_response/index.ts b/x-pack/plugins/ecs_data_quality_dashboard/server/lib/build_response/index.ts index bbec702c74915b..343601f1c33669 100644 --- a/x-pack/plugins/ecs_data_quality_dashboard/server/lib/build_response/index.ts +++ b/x-pack/plugins/ecs_data_quality_dashboard/server/lib/build_response/index.ts @@ -41,10 +41,13 @@ export class ResponseFactory { constructor(private response: KibanaResponseFactory) {} /** error */ + // @ts-expect-error upgrade typescript v4.9.5 error({ statusCode, body, headers }: CustomHttpResponseOptions) { + // @ts-expect-error upgrade typescript v4.9.5 const contentType: CustomHttpResponseOptions['headers'] = { 'content-type': 'application/json', }; + // @ts-expect-error upgrade typescript v4.9.5 const defaultedHeaders: CustomHttpResponseOptions['headers'] = { ...contentType, ...(headers ?? {}), diff --git a/x-pack/plugins/elastic_assistant/server/lib/build_response/index.ts b/x-pack/plugins/elastic_assistant/server/lib/build_response/index.ts index bbec702c74915b..343601f1c33669 100644 --- a/x-pack/plugins/elastic_assistant/server/lib/build_response/index.ts +++ b/x-pack/plugins/elastic_assistant/server/lib/build_response/index.ts @@ -41,10 +41,13 @@ export class ResponseFactory { constructor(private response: KibanaResponseFactory) {} /** error */ + // @ts-expect-error upgrade typescript v4.9.5 error({ statusCode, body, headers }: CustomHttpResponseOptions) { + // @ts-expect-error upgrade typescript v4.9.5 const contentType: CustomHttpResponseOptions['headers'] = { 'content-type': 'application/json', }; + // @ts-expect-error upgrade typescript v4.9.5 const defaultedHeaders: CustomHttpResponseOptions['headers'] = { ...contentType, ...(headers ?? {}), diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector_total_stats.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector_total_stats.tsx index fc3fde9dea5493..2fceb211c86c42 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector_total_stats.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector_total_stats.tsx @@ -38,6 +38,7 @@ export const ConnectorTotalStats: React.FC = () => { const stats: EuiStatProps[] & { 'data-test-subj'?: string } = [ { + // @ts-expect-error upgrade typescript v4.9.5 'data-test-subj': 'entSearchContent-indexOverview-totalStats-ingestionType', description: i18n.translate( 'xpack.enterpriseSearch.content.searchIndex.totalStats.ingestionTypeCardLabel', @@ -54,6 +55,7 @@ export const ConnectorTotalStats: React.FC = () => { ), }, { + // @ts-expect-error upgrade typescript v4.9.5 'data-test-subj': 'entSearchContent-indexOverview-totalStats-connectorType', description: i18n.translate('xpack.enterpriseSearch.connector.connectorTypePanel.title', { defaultMessage: 'Connector type', diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler_total_stats.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler_total_stats.tsx index f5a72ac475fd9c..9dec32c1415d2c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler_total_stats.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler_total_stats.tsx @@ -31,6 +31,7 @@ export const CrawlerTotalStats: React.FC = () => { const stats: EuiStatProps[] & { 'data-test-subj'?: string } = [ { + // @ts-expect-error upgrade typescript v4.9.5 'data-test-subj': 'entSearchContent-indexOverview-totalStats-ingestionType', description: i18n.translate( 'xpack.enterpriseSearch.content.searchIndex.totalStats.ingestionTypeCardLabel', @@ -57,6 +58,7 @@ export const CrawlerTotalStats: React.FC = () => { title: domains.length, }, { + // @ts-expect-error upgrade typescript v4.9.5 'data-test-subj': 'entSearchContent-indexOverview-totalStats-documentCount', description: i18n.translate( 'xpack.enterpriseSearch.content.searchIndex.totalStats.documentCountCardLabel', diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_json_configurations_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_json_configurations_logic.ts index d450dff591f6ca..d81cae698db984 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_json_configurations_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_json_configurations_logic.ts @@ -52,6 +52,7 @@ export const IndexPipelinesConfigurationsLogic = kea< }, events: ({ actions, values }) => ({ afterMount: () => { + // @ts-expect-error upgrade typescript v4.9.5 if (!values.indexPipelinesData || values.indexPipelinesData.length === 0) { return; } diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/accordion_list/accordion_list.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/accordion_list/accordion_list.test.tsx index 13fe9c8f0efd92..cbed21624bdb83 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/accordion_list/accordion_list.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/accordion_list/accordion_list.test.tsx @@ -29,6 +29,7 @@ describe('AccordionList', () => { it('renders as an accordion with the passed in title and icon', () => { expect(wrapper.is(EuiAccordion)).toBe(true); + // @ts-expect-error upgrade typescript v4.9.5 const buttonContent = shallow(wrapper.prop('buttonContent')); expect(buttonContent.find(EuiIcon).prop('type')).toEqual('globe'); @@ -36,6 +37,7 @@ describe('AccordionList', () => { }); it('shows the item count', () => { + // @ts-expect-error upgrade typescript v4.9.5 const extraActionContent = shallow(wrapper.prop('extraAction')); expect(extraActionContent.text()).toEqual('2'); diff --git a/x-pack/plugins/fleet/.storybook/context/fixtures/integration.nginx.ts b/x-pack/plugins/fleet/.storybook/context/fixtures/integration.nginx.ts index 8f47d564c44a2c..37ac4fa8119471 100644 --- a/x-pack/plugins/fleet/.storybook/context/fixtures/integration.nginx.ts +++ b/x-pack/plugins/fleet/.storybook/context/fixtures/integration.nginx.ts @@ -19,6 +19,7 @@ export const item: GetInfoResponse['item'] = { icons: [ { src: '/img/logo_nginx.svg', + // @ts-expect-error upgrade typescript v4.9.5 path: '/package/nginx/0.7.0/img/logo_nginx.svg', title: 'logo nginx', size: '32x32', diff --git a/x-pack/plugins/fleet/common/authz.test.ts b/x-pack/plugins/fleet/common/authz.test.ts index c7686083a6bed3..28a01e72992b62 100644 --- a/x-pack/plugins/fleet/common/authz.test.ts +++ b/x-pack/plugins/fleet/common/authz.test.ts @@ -21,7 +21,7 @@ import { ENDPOINT_PRIVILEGES } from './constants'; const SECURITY_SOLUTION_ID = DEFAULT_APP_CATEGORIES.security.id; function generateActions(privileges: T, overrides: Record = {}) { - return Object.keys(privileges).reduce((acc, privilege) => { + return Object.keys(privileges as any).reduce((acc, privilege) => { const executePackageAction = overrides[privilege] || false; return { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/hooks/use_confirm_modal.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/hooks/use_confirm_modal.tsx index aa284ed64f2c97..a3b3b5f9bbf7df 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/hooks/use_confirm_modal.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/hooks/use_confirm_modal.tsx @@ -56,6 +56,7 @@ export function useConfirmModal() { export function withConfirmModalProvider(WrappedComponent: React.FunctionComponent) { return (props: T) => ( + {/* @ts-expect-error upgrade typescript v4.9.5*/} ); diff --git a/x-pack/plugins/fleet/server/services/preconfiguration.ts b/x-pack/plugins/fleet/server/services/preconfiguration.ts index 8a4944ddb99ad4..a6c05bf969ff25 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration.ts @@ -305,6 +305,7 @@ export async function ensurePreconfiguredPackagesAndPolicies( }), } ), + // @ts-expect-error upgrade typescript v4.9.5 packages: fulfilledPackages.map((pkg) => ('version' in pkg ? pkgToPkgKey(pkg) : pkg.name)), nonFatalErrors: [...rejectedPackages, ...rejectedPolicies], }; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/form_errors_context.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/form_errors_context.tsx index 70199e08aa3084..dfe7858eb3c7de 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/form_errors_context.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/form_errors_context.tsx @@ -86,6 +86,7 @@ export const FormErrorsProvider: FunctionComponent = ({ children }) => { const nextHasErrors = Object.keys(restOfPhaseErrors).length > 0 || Object.values(otherPhases).some((phaseErrors) => { + // @ts-expect-error upgrade typescript v4.9.5 return Object.keys(phaseErrors).length > 0; }); diff --git a/x-pack/plugins/infra/public/containers/metrics_source/source.tsx b/x-pack/plugins/infra/public/containers/metrics_source/source.tsx index e543d5793339c7..336b07b6986753 100644 --- a/x-pack/plugins/infra/public/containers/metrics_source/source.tsx +++ b/x-pack/plugins/infra/public/containers/metrics_source/source.tsx @@ -148,6 +148,7 @@ export const withSourceProvider = return function ComponentWithSourceProvider(props: ComponentProps) { return ( + {/* @ts-expect-error upgrade typescript v4.9.5*/} ); diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/section.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/section.tsx index 4642a1981a2c17..504ca07ec0ca34 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/section.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/section.tsx @@ -65,6 +65,7 @@ export const Section: FunctionComponent = ({ const childrenWithProps = Children.map(children, (child) => isValidElement(child) ? cloneElement(child, { + // @ts-expect-error upgrade typescript v4.9.5 metrics, onChangeRangeTime, isLiveStreaming, diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/sub_section.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/sub_section.tsx index 10d8908c793745..4d66b822661d0a 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/sub_section.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/sub_section.tsx @@ -33,6 +33,7 @@ export const SubSection: FunctionComponent = ({ const childrenWithProps = Children.map(children, (child) => { if (isValidElement(child)) { return cloneElement(child, { + // @ts-expect-error upgrade typescript v4.9.5 metric, id, onChangeRangeTime, diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.test.tsx index c86d12017c21a5..06a118dc165cee 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.test.tsx @@ -56,10 +56,12 @@ const operationDefinitionMap: Record = { }), derivative: createOperationDefinitionMock('derivative', { input: 'fullReference' }), moving_average: createOperationDefinitionMock('moving_average', { + // @ts-expect-error upgrade typescript v4.9.5 input: 'fullReference', operationParams: [{ name: 'window', type: 'number', required: true }], filterable: true, getErrorMessage: jest.fn(() => ['mock error']), + // @ts-expect-error upgrade typescript v4.9.5 buildColumn: ({ referenceIds }, columnsParams) => ({ label: 'moving_average', dataType: 'number', diff --git a/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx b/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx deleted file mode 100644 index d52eb3c5780591..00000000000000 --- a/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { mountWithIntl as mount } from '@kbn/test-jest-helpers'; -import { debouncedComponent } from './debounced_component'; -import { act } from 'react-dom/test-utils'; - -describe('debouncedComponent', () => { - test('immediately renders', () => { - const TestComponent = debouncedComponent(({ title }: { title: string }) => { - return

{title}

; - }); - expect(mount().html()).toMatchInlineSnapshot(`"

hoi

"`); - }); - - test('debounces changes', async () => { - const TestComponent = debouncedComponent(({ title }: { title: string }) => { - return

{title}

; - }, 1); - const component = mount(); - component.setProps({ title: 'yall' }); - expect(component.text()).toEqual('there'); - await act(async () => { - await new Promise((r) => setTimeout(r, 10)); - }); - expect(component.text()).toEqual('yall'); - }); -}); diff --git a/x-pack/plugins/lens/public/debounced_component/debounced_component.tsx b/x-pack/plugins/lens/public/debounced_component/debounced_component.tsx deleted file mode 100644 index 1f341c39d9fadd..00000000000000 --- a/x-pack/plugins/lens/public/debounced_component/debounced_component.tsx +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { useState, useMemo, useEffect, memo, FunctionComponent } from 'react'; -import { debounce } from 'lodash'; - -/** - * debouncedComponent wraps the specified React component, returning a component which - * only renders once there is a pause in props changes for at least `delay` milliseconds. - * During the debounce phase, it will return the previously rendered value. - */ -export function debouncedComponent(component: FunctionComponent, delay = 256) { - const MemoizedComponent = memo(component) as unknown as FunctionComponent; - - return (props: TProps) => { - const [cachedProps, setCachedProps] = useState(props); - const debouncePropsChange = useMemo(() => debounce(setCachedProps, delay), [setCachedProps]); - - // cancel debounced prop change if component has been unmounted in the meantime - useEffect(() => () => debouncePropsChange.cancel(), [debouncePropsChange]); - debouncePropsChange(props); - - return React.createElement(MemoizedComponent, cachedProps); - }; -} diff --git a/x-pack/plugins/lens/public/debounced_component/index.ts b/x-pack/plugins/lens/public/debounced_component/index.ts deleted file mode 100644 index 68d247b5e3b3f9..00000000000000 --- a/x-pack/plugins/lens/public/debounced_component/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export * from './debounced_component'; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx index 66d99d187a3690..c73f427fcd7f9b 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx @@ -18,11 +18,6 @@ import { } from '../../../mocks'; import { mockDataPlugin, mountWithProvider } from '../../../mocks'; -jest.mock('../../../debounced_component', () => { - return { - debouncedComponent: (fn: unknown) => fn, - }; -}); import { WorkspacePanel } from './workspace_panel'; import { ReactWrapper } from 'enzyme'; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx index 842904741ec9bc..3e90a4179f9ebe 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx @@ -777,6 +777,7 @@ export const VisualizationWrapper = ({ searchSessionId={searchSessionId} onEvent={onEvent} hasCompatibleActions={hasCompatibleActions} + // @ts-expect-error upgrade typescript v4.9.5 onData$={onData$} onRender$={onRenderHandler} inspectorAdapters={lensInspector.adapters} diff --git a/x-pack/plugins/lens/public/embeddable/expression_wrapper.tsx b/x-pack/plugins/lens/public/embeddable/expression_wrapper.tsx index 8540058683c11a..63a2a6aabe3fe3 100644 --- a/x-pack/plugins/lens/public/embeddable/expression_wrapper.tsx +++ b/x-pack/plugins/lens/public/embeddable/expression_wrapper.tsx @@ -86,6 +86,7 @@ export function ExpressionWrapper({ interactive={interactive} searchContext={searchContext} searchSessionId={searchSessionId} + // @ts-expect-error upgrade typescript v4.9.5 onData$={onData$} onRender$={onRender$} inspectorAdapters={lensInspector.adapters} diff --git a/x-pack/plugins/lens/public/state_management/lens_slice.ts b/x-pack/plugins/lens/public/state_management/lens_slice.ts index b7b02bdbc934b4..dc59192c2d1956 100644 --- a/x-pack/plugins/lens/public/state_management/lens_slice.ts +++ b/x-pack/plugins/lens/public/state_management/lens_slice.ts @@ -877,7 +877,7 @@ export const makeLensReducer = (storeDeps: LensStoreDeps) => { activeVisualization.removeLayer && state.visualization.state ) { - const updater = layerIds.reduce( + const updater = layerIds.reduce( (acc, layerId) => activeVisualization.removeLayer ? activeVisualization.removeLayer(acc, layerId) : acc, state.visualization.state diff --git a/x-pack/plugins/lens/server/migrations/common_migrations.ts b/x-pack/plugins/lens/server/migrations/common_migrations.ts index c1be1008ad682d..f6a683afc22973 100644 --- a/x-pack/plugins/lens/server/migrations/common_migrations.ts +++ b/x-pack/plugins/lens/server/migrations/common_migrations.ts @@ -502,7 +502,11 @@ export const commonMigratePartitionChartGroups = ( }> ): LensDocShape850<{ shape: string; - layers: Array<{ primaryGroups?: string[]; secondaryGroups?: string[] }>; + layers: Array<{ + primaryGroups?: string[]; + secondaryGroups?: string[]; + [key: string]: unknown; // unknown carryover key/values + }>; }> => { if ( attributes.state.visualization?.layers && diff --git a/x-pack/plugins/lists/server/routes/utils/build_siem_response.ts b/x-pack/plugins/lists/server/routes/utils/build_siem_response.ts index d61a02a869d28a..99552d332eca22 100644 --- a/x-pack/plugins/lists/server/routes/utils/build_siem_response.ts +++ b/x-pack/plugins/lists/server/routes/utils/build_siem_response.ts @@ -48,12 +48,15 @@ const statusToErrorMessage = ( export class SiemResponseFactory { constructor(private response: KibanaResponseFactory) {} + // @ts-expect-error upgrade typescript v4.9.5 // eslint-disable-next-line @typescript-eslint/explicit-function-return-type error({ statusCode, body, headers, bypassErrorFormat }: CustomHttpResponseOptions) { // KibanaResponse is not exported so we cannot use a return type here and that is why the linter is turned off above + // @ts-expect-error upgrade typescript v4.9.5 const contentType: CustomHttpResponseOptions['headers'] = { 'content-type': 'application/json', }; + // @ts-expect-error upgrade typescript v4.9.5 const defaultedHeaders: CustomHttpResponseOptions['headers'] = { ...contentType, ...(headers ?? {}), diff --git a/x-pack/plugins/logs_shared/public/components/logging/log_text_stream/vertical_scroll_panel.tsx b/x-pack/plugins/logs_shared/public/components/logging/log_text_stream/vertical_scroll_panel.tsx index 81d77aa66c1a51..99219b5c77507c 100644 --- a/x-pack/plugins/logs_shared/public/components/logging/log_text_stream/vertical_scroll_panel.tsx +++ b/x-pack/plugins/logs_shared/public/components/logging/log_text_stream/vertical_scroll_panel.tsx @@ -104,6 +104,7 @@ export class VerticalScrollPanel extends React.PureComponent< }, } = this; + // @ts-expect-error upgrade typescript v4.9.5 return getVisibleChildren(Array.from(childDimensions.entries()), scrollViewHeight, scrollTop); }; @@ -135,8 +136,11 @@ export class VerticalScrollPanel extends React.PureComponent< } onVisibleChildrenChange({ + // @ts-expect-error upgrade typescript v4.9.5 bottomChild: visibleChildren.bottomChild, + // @ts-expect-error upgrade typescript v4.9.5 middleChild: visibleChildren.middleChild, + // @ts-expect-error upgrade typescript v4.9.5 topChild: visibleChildren.topChild, fromScroll, ...scrollPosition, @@ -205,6 +209,7 @@ export class VerticalScrollPanel extends React.PureComponent< if (visibleChildren) { return { scrollOffset: visibleChildren.middleChildOffset, + // @ts-expect-error upgrade typescript v4.9.5 scrollTarget: visibleChildren.middleChild, }; } diff --git a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts index d982bfaf09f5d7..0e5a48b3d58272 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts +++ b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts @@ -185,9 +185,11 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource const buffer: MapExtent = 'isGeoGridPrecisionAware' in this && 'getGeoGridPrecision' in this && + // @ts-expect-error upgrade typescript v4.9.5 (this as IESAggSource).isGeoGridPrecisionAware() ? expandToTileBoundaries( requestMeta.buffer, + // @ts-expect-error upgrade typescript v4.9.5 (this as IESAggSource).getGeoGridPrecision(requestMeta.zoom) ) : requestMeta.buffer; 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 9fc1ccaf38c843..72a930553f4ec5 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 @@ -350,6 +350,7 @@ export class DynamicStyleProperty } getDataMappingFunction() { + // @ts-expect-error upgrade typescript v4.9.5 return 'dataMappingFunction' in this._options ? (this._options as T & { dataMappingFunction: DATA_MAPPING_FUNCTION }).dataMappingFunction : DATA_MAPPING_FUNCTION.INTERPOLATE; diff --git a/x-pack/plugins/maps/public/classes/styles/vector/symbol_utils.tsx b/x-pack/plugins/maps/public/classes/styles/vector/symbol_utils.tsx index 5a2c1bc687a0e5..a0a2b27abb2f44 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/symbol_utils.tsx +++ b/x-pack/plugins/maps/public/classes/styles/vector/symbol_utils.tsx @@ -59,6 +59,7 @@ export async function createSdfIcon({ svgCanvas.width = size; svgCanvas.height = size; const svgCtx = svgCanvas.getContext('2d'); + // @ts-expect-error upgrade typescript v4.9.5 const v = Canvg.fromString(svgCtx, svg, { ignoreDimensions: true, offsetX: buffer / 2, diff --git a/x-pack/plugins/maps/public/lazy_wrapper.tsx b/x-pack/plugins/maps/public/lazy_wrapper.tsx index 38740267f39b4d..184cbc310da465 100644 --- a/x-pack/plugins/maps/public/lazy_wrapper.tsx +++ b/x-pack/plugins/maps/public/lazy_wrapper.tsx @@ -24,6 +24,7 @@ export function LazyWrapper({ getLazyComponent, lazyComponentProps }: Props }> + {/* @ts-expect-error upgrade typescript v4.9.5*/} diff --git a/x-pack/plugins/observability_solution/apm/server/lib/helpers/transactions/get_is_using_transaction_events.test.ts b/x-pack/plugins/observability_solution/apm/server/lib/helpers/transactions/get_is_using_transaction_events.test.ts index ff118ed5b16c63..9ea7b81ea710cb 100644 --- a/x-pack/plugins/observability_solution/apm/server/lib/helpers/transactions/get_is_using_transaction_events.test.ts +++ b/x-pack/plugins/observability_solution/apm/server/lib/helpers/transactions/get_is_using_transaction_events.test.ts @@ -116,9 +116,11 @@ describe('getIsUsingTransactionEvents', () => { { config, mockResponse: (request) => { + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_aggregated_transactions') { return mockResponseSomeHits; } + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_transactions') { return mockResponseNoHits; } @@ -141,9 +143,11 @@ describe('getIsUsingTransactionEvents', () => { { config, mockResponse: (request) => { + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_aggregated_transactions') { return mockResponseNoHits; } + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_transactions') { return mockResponseSomeHits; } @@ -199,9 +203,11 @@ describe('getIsUsingTransactionEvents', () => { { config, mockResponse: (request) => { + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_aggregated_transactions') { return mockResponseSomeHits; } + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_transactions') { return mockResponseNoHits; } @@ -224,9 +230,11 @@ describe('getIsUsingTransactionEvents', () => { { config, mockResponse: (request) => { + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_aggregated_transactions') { return mockResponseNoHits; } + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_transactions') { return mockResponseSomeHits; } @@ -249,9 +257,11 @@ describe('getIsUsingTransactionEvents', () => { { config, mockResponse: (request) => { + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_aggregated_transactions') { return mockResponseSomeHits; } + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_transactions') { return mockResponseNoHits; } @@ -273,9 +283,11 @@ describe('getIsUsingTransactionEvents', () => { { config, mockResponse: (request) => { + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_aggregated_transactions') { return mockResponseNoHits; } + // @ts-expect-error upgrade typescript v4.9.5 if (request === 'get_has_transactions') { return mockResponseSomeHits; } diff --git a/x-pack/plugins/observability_solution/logs_explorer/public/utils/proxies.ts b/x-pack/plugins/observability_solution/logs_explorer/public/utils/proxies.ts index 5599f061f4d672..cfe4c133ec328a 100644 --- a/x-pack/plugins/observability_solution/logs_explorer/public/utils/proxies.ts +++ b/x-pack/plugins/observability_solution/logs_explorer/public/utils/proxies.ts @@ -21,7 +21,7 @@ export const createPropertyGetProxy = new Proxy(target, { get(accessedTarget, accessedKey, ...rest) { - const value = Reflect.get(accessedTarget, accessedKey, ...rest); + const value = Reflect.get(accessedTarget, accessedKey, ...rest) as Target[Key]; if (hasKey(replacements, accessedKey)) { return replacements[accessedKey](value); } else { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/shared_flyout/slo_form.tsx b/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/shared_flyout/slo_form.tsx index 5588e27163893a..8c105e6159797c 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/shared_flyout/slo_form.tsx +++ b/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/shared_flyout/slo_form.tsx @@ -25,6 +25,7 @@ function suspendedComponentWithProps( ) { return (props: T) => ( }> + {/* @ts-expect-error upgrade typescript v4.9.5 */} ); diff --git a/x-pack/plugins/observability_solution/observability_shared/public/contexts/inspector/inspector_context.tsx b/x-pack/plugins/observability_solution/observability_shared/public/contexts/inspector/inspector_context.tsx index 0b87f0e4a5476c..208788b9b9aede 100644 --- a/x-pack/plugins/observability_solution/observability_shared/public/contexts/inspector/inspector_context.tsx +++ b/x-pack/plugins/observability_solution/observability_shared/public/contexts/inspector/inspector_context.tsx @@ -13,7 +13,7 @@ import { FetcherResult } from '../../hooks/use_fetcher'; type InspectResponse = Request[]; export interface InspectorContextValue { - addInspectorRequest: (result: FetcherResult) => void; + addInspectorRequest: (result: FetcherResult) => void; inspectorAdapters: { requests: RequestAdapter }; } @@ -24,12 +24,12 @@ const value: InspectorContextValue = { export const InspectorContext = createContext(value); -export type AddInspectorRequest = ( - result: FetcherResult<{ - mainStatisticsData?: { _inspect?: InspectResponse }; - _inspect?: InspectResponse; - }> -) => void; +export interface InspectorRequestProps { + mainStatisticsData?: { _inspect?: InspectResponse }; + _inspect?: InspectResponse; +} + +export type AddInspectorRequest = (result: FetcherResult) => void; export function InspectorContextProvider({ children }: { children: ReactNode }) { const history = useHistory(); diff --git a/x-pack/plugins/observability_solution/synthetics/common/runtime_types/monitor_management/locations.ts b/x-pack/plugins/observability_solution/synthetics/common/runtime_types/monitor_management/locations.ts index 60c74be13c2283..4445fd22172cf1 100644 --- a/x-pack/plugins/observability_solution/synthetics/common/runtime_types/monitor_management/locations.ts +++ b/x-pack/plugins/observability_solution/synthetics/common/runtime_types/monitor_management/locations.ts @@ -133,6 +133,7 @@ export const ServiceLocationsApiResponseCodec = t.interface({ throttling: t.union([ThrottlingOptionsCodec, t.undefined]), locations: ServiceLocationsCodec, }); +export type ServiceLocationsApiResponse = t.TypeOf; export type ManifestLocation = t.TypeOf; export type ServiceLocation = t.TypeOf; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_add_edit/form/validation.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_add_edit/form/validation.tsx index c22a89f63fa14b..7b6fa39b97c543 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_add_edit/form/validation.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_add_edit/form/validation.tsx @@ -21,7 +21,7 @@ export const FLOATS_ONLY = /^[0-9]+(.?[0-9]+)?$/; type ValidationLibrary = Record; // returns true if invalid -export function validateHeaders(headers: T): boolean { +export function validateHeaders(headers: object): boolean { return Object.keys(headers).some((key) => { if (key) { const whiteSpaceRegEx = /[\s]/g; @@ -110,11 +110,11 @@ const validateHTTP: ValidationLibrary = { }, [ConfigKey.RESPONSE_HEADERS_CHECK]: ({ [ConfigKey.RESPONSE_HEADERS_CHECK]: value }) => { const headers = value as MonitorFields[ConfigKey.RESPONSE_HEADERS_CHECK]; - return validateHeaders(headers); + return validateHeaders(headers); }, [ConfigKey.REQUEST_HEADERS_CHECK]: ({ [ConfigKey.REQUEST_HEADERS_CHECK]: value }) => { const headers = value as MonitorFields[ConfigKey.REQUEST_HEADERS_CHECK]; - return validateHeaders(headers); + return validateHeaders(headers); }, [ConfigKey.MAX_REDIRECTS]: ({ [ConfigKey.MAX_REDIRECTS]: value }) => (!!value && !`${value}`.match(DIGITS_ONLY)) || diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/service_locations/api.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/service_locations/api.ts index e383905de552e7..28102ee31afd3c 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/service_locations/api.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/service_locations/api.ts @@ -8,6 +8,7 @@ import { SYNTHETICS_API_URLS } from '../../../../../common/constants'; import { ServiceLocations, + ServiceLocationsApiResponse, ServiceLocationsApiResponseCodec, ThrottlingOptions, } from '../../../../../common/runtime_types'; @@ -17,7 +18,7 @@ export const fetchServiceLocations = async (): Promise<{ throttling: ThrottlingOptions | undefined; locations: ServiceLocations; }> => { - const { throttling, locations } = await apiService.get( + const { throttling, locations } = await apiService.get( SYNTHETICS_API_URLS.SERVICE_LOCATIONS, undefined, ServiceLocationsApiResponseCodec diff --git a/x-pack/plugins/observability_solution/synthetics/public/utils/api_service/api_service.ts b/x-pack/plugins/observability_solution/synthetics/public/utils/api_service/api_service.ts index e077e37d098355..5aac19589bf685 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/utils/api_service/api_service.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/utils/api_service/api_service.ts @@ -9,6 +9,7 @@ import { isRight } from 'fp-ts/lib/Either'; import { formatErrors } from '@kbn/securitysolution-io-ts-utils'; import { HttpFetchQuery, HttpSetup } from '@kbn/core/public'; import { FETCH_STATUS, AddInspectorRequest } from '@kbn/observability-shared-plugin/public'; +import { InspectorRequestProps } from '@kbn/observability-shared-plugin/public/contexts/inspector/inspector_context'; type Params = HttpFetchQuery & { version?: string }; class ApiService { private static instance: ApiService; @@ -68,7 +69,11 @@ class ApiService { version, }); - this.addInspectorRequest?.({ data: response, status: FETCH_STATUS.SUCCESS, loading: false }); + this.addInspectorRequest?.({ + data: response as InspectorRequestProps, + status: FETCH_STATUS.SUCCESS, + loading: false, + }); return this.parseResponse(response, apiUrl, decodeType); } @@ -83,7 +88,11 @@ class ApiService { version, }); - this.addInspectorRequest?.({ data: response, status: FETCH_STATUS.SUCCESS, loading: false }); + this.addInspectorRequest?.({ + data: response as InspectorRequestProps, + status: FETCH_STATUS.SUCCESS, + loading: false, + }); return this.parseResponse(response, apiUrl, decodeType); } diff --git a/x-pack/plugins/observability_solution/synthetics/server/routes/create_route_with_auth.ts b/x-pack/plugins/observability_solution/synthetics/server/routes/create_route_with_auth.ts index d9b6f672eb3e0d..aa254e275b9b0a 100644 --- a/x-pack/plugins/observability_solution/synthetics/server/routes/create_route_with_auth.ts +++ b/x-pack/plugins/observability_solution/synthetics/server/routes/create_route_with_auth.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { HttpResponsePayload, ResponseError } from '@kbn/core-http-server'; import { ILicense } from '@kbn/licensing-plugin/server'; import { LICENSE_MISSING_ERROR, @@ -23,7 +24,9 @@ function getDefaultWriteAccessFlag(method: SupportedMethod) { return method !== 'GET'; } -export const createSyntheticsRouteWithAuth = ( +export const createSyntheticsRouteWithAuth = < + ClientContract extends HttpResponsePayload | ResponseError = any +>( routeCreator: SyntheticsRestApiRouteFactory ): SyntheticsRoute => { const restRoute = routeCreator(); diff --git a/x-pack/plugins/observability_solution/synthetics/server/routes/types.ts b/x-pack/plugins/observability_solution/synthetics/server/routes/types.ts index aa3f161675ae83..dfbcac3d3b9830 100644 --- a/x-pack/plugins/observability_solution/synthetics/server/routes/types.ts +++ b/x-pack/plugins/observability_solution/synthetics/server/routes/types.ts @@ -16,7 +16,7 @@ import { KibanaResponseFactory, IKibanaResponse, } from '@kbn/core/server'; -import { FullValidationConfig } from '@kbn/core-http-server'; +import { FullValidationConfig, HttpResponsePayload, ResponseError } from '@kbn/core-http-server'; import { UptimeEsClient } from '../lib'; import { SyntheticsServerSetup, UptimeRequestHandlerContext } from '../types'; import { SyntheticsMonitorClient } from '../synthetics_service/synthetics_monitor/synthetics_monitor_client'; @@ -60,14 +60,14 @@ export type UMKibanaRoute = UMRouteDefinition< >; export type SyntheticsRestApiRouteFactory< - ClientContract = any, + ClientContract extends HttpResponsePayload | ResponseError = any, Params = any, Query = Record, Body = any > = () => SyntheticsRoute; export type SyntheticsRoute< - ClientContract = unknown, + ClientContract extends HttpResponsePayload | ResponseError = any, Params = Record, Query = Record, Body = any @@ -106,7 +106,7 @@ export interface RouteContext< } export type SyntheticsRouteHandler< - ClientContract, + ClientContract extends HttpResponsePayload | ResponseError = any, Params = Record, Query = Record, Body = any @@ -117,5 +117,5 @@ export type SyntheticsRouteHandler< response, server, savedObjectsClient, - subject: Subject, + subject, }: RouteContext) => Promise | ClientContract>; diff --git a/x-pack/plugins/observability_solution/synthetics/server/synthetics_service/service_api_client.ts b/x-pack/plugins/observability_solution/synthetics/server/synthetics_service/service_api_client.ts index e30b9a18872a9f..92d29145593abf 100644 --- a/x-pack/plugins/observability_solution/synthetics/server/synthetics_service/service_api_client.ts +++ b/x-pack/plugins/observability_solution/synthetics/server/synthetics_service/service_api_client.ts @@ -280,15 +280,20 @@ export class ServiceAPIClient { }; } + isLoggable(result: unknown): result is { status?: any; request?: any } { + const objCast = result as object; + return Object.keys(objCast).some((k) => k === 'status' || k === 'request'); + } + logSuccessMessage( url: string, method: string, numMonitors: number, - result: AxiosResponse | ServicePayload + result: AxiosResponse | ServicePayload ) { - if ('status' in result || 'request' in result) { + if (this.isLoggable(result)) { if (result.data) { - this.logger.debug(result.data); + this.logger.debug(result.data as any); } this.logger.debug( `Successfully called service location ${url}${result.request?.path} with method ${method} with ${numMonitors} monitors` diff --git a/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/common/monitor_tags.test.tsx b/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/common/monitor_tags.test.tsx index 2bfe598a585751..ab79fe400221e3 100644 --- a/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/common/monitor_tags.test.tsx +++ b/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/common/monitor_tags.test.tsx @@ -143,6 +143,7 @@ describe('MonitorTags component', () => { }); it('render against summary', () => { + // @ts-expect-error upgrade typescript v4.9.5 test object types do not correspond 100% const component = shallowWithRouter(); // dive() removes all unnecessary React-Router wrapping elements expect(component.dive()).toMatchSnapshot(); diff --git a/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/state/api/utils.ts b/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/state/api/utils.ts index 5fed6706b95364..6443b1b1bd103a 100644 --- a/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/state/api/utils.ts +++ b/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/state/api/utils.ts @@ -9,6 +9,7 @@ import { isRight } from 'fp-ts/lib/Either'; import { formatErrors } from '@kbn/securitysolution-io-ts-utils'; import { HttpFetchQuery, HttpSetup } from '@kbn/core/public'; import { FETCH_STATUS, AddInspectorRequest } from '@kbn/observability-shared-plugin/public'; +import { InspectorRequestProps } from '@kbn/observability-shared-plugin/public/contexts/inspector/inspector_context'; type Params = HttpFetchQuery & { version?: string }; class ApiService { @@ -51,7 +52,11 @@ class ApiService { version, }); - this.addInspectorRequest?.({ data: response, status: FETCH_STATUS.SUCCESS, loading: false }); + this.addInspectorRequest?.({ + data: response as InspectorRequestProps, + status: FETCH_STATUS.SUCCESS, + loading: false, + }); if (decodeType) { const decoded = decodeType.decode(response); @@ -80,7 +85,11 @@ class ApiService { version, }); - this.addInspectorRequest?.({ data: response, status: FETCH_STATUS.SUCCESS, loading: false }); + this.addInspectorRequest?.({ + data: response as InspectorRequestProps, + status: FETCH_STATUS.SUCCESS, + loading: false, + }); if (decodeType) { const decoded = decodeType.decode(response); diff --git a/x-pack/plugins/observability_solution/uptime/public/utils/api_service/api_service.ts b/x-pack/plugins/observability_solution/uptime/public/utils/api_service/api_service.ts index b73b353f708f2e..95d0886954e643 100644 --- a/x-pack/plugins/observability_solution/uptime/public/utils/api_service/api_service.ts +++ b/x-pack/plugins/observability_solution/uptime/public/utils/api_service/api_service.ts @@ -9,6 +9,7 @@ import { isRight } from 'fp-ts/lib/Either'; import { formatErrors } from '@kbn/securitysolution-io-ts-utils'; import { HttpFetchQuery, HttpSetup } from '@kbn/core/public'; import { FETCH_STATUS, AddInspectorRequest } from '@kbn/observability-shared-plugin/public'; +import { InspectorRequestProps } from '@kbn/observability-shared-plugin/public/contexts/inspector/inspector_context'; class ApiService { private static instance: ApiService; @@ -53,7 +54,11 @@ class ApiService { asResponse, }); - this.addInspectorRequest?.({ data: response, status: FETCH_STATUS.SUCCESS, loading: false }); + this.addInspectorRequest?.({ + data: response as InspectorRequestProps, + status: FETCH_STATUS.SUCCESS, + loading: false, + }); if (decodeType) { const decoded = decodeType.decode(response); @@ -80,7 +85,11 @@ class ApiService { query: params, }); - this.addInspectorRequest?.({ data: response, status: FETCH_STATUS.SUCCESS, loading: false }); + this.addInspectorRequest?.({ + data: response as InspectorRequestProps, + status: FETCH_STATUS.SUCCESS, + loading: false, + }); if (decodeType) { const decoded = decodeType.decode(response); diff --git a/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/search/query_context.ts b/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/search/query_context.ts index 0c88a2527aa4b5..1ab9d9ece169ff 100644 --- a/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/search/query_context.ts +++ b/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/search/query_context.ts @@ -7,7 +7,8 @@ import moment from 'moment'; import type { ESFilter } from '@kbn/es-types'; -import { CursorPagination } from './types'; +import type { SearchRequest } from '@kbn/data-plugin/common'; +import type { CursorPagination } from './types'; import { CursorDirection, SortOrder } from '../../../../../common/runtime_types'; import { UptimeEsClient } from '../../lib'; import { parseRelativeDate } from '../../../../../common/lib/get_histogram_interval'; @@ -43,7 +44,7 @@ export class QueryContext { this.query = query; } - async search(params: TParams, operationName?: string) { + async search(params: TParams, operationName?: string) { return this.callES.search(params, operationName); } diff --git a/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/search/refine_potential_matches.ts b/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/search/refine_potential_matches.ts index c1e4150f11cf33..7956966ec71c56 100644 --- a/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/search/refine_potential_matches.ts +++ b/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/search/refine_potential_matches.ts @@ -99,6 +99,7 @@ export const summaryPingsToSummary = (summaryPings: Ping[]): MonitorSummary => { status: summaryPings.some((p) => (p.summary?.down ?? 0) > 0) ? 'down' : 'up', }, summaryPings, + // @ts-expect-error upgrade typescript v4.9.5 tls: latest.tls, // easier to ensure to use '' for an empty geo name in terms of types observer: { diff --git a/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/routes/types.ts b/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/routes/types.ts index 22e34437e5d1b2..d7ab40c4891d1c 100644 --- a/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/routes/types.ts +++ b/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/routes/types.ts @@ -100,7 +100,7 @@ export type UMRouteHandler = ({ response, server, savedObjectsClient, - subject, + subject, // @ts-expect-error upgrade typescript v4.9.5 }: UptimeRouteContext) => Promise | ClientContract>; export interface RouteContext> { diff --git a/x-pack/plugins/observability_solution/ux/public/application/ux_app.tsx b/x-pack/plugins/observability_solution/ux/public/application/ux_app.tsx index e8fdbb96b5e7ba..e9e7d72dd72048 100644 --- a/x-pack/plugins/observability_solution/ux/public/application/ux_app.tsx +++ b/x-pack/plugins/observability_solution/ux/public/application/ux_app.tsx @@ -49,6 +49,7 @@ import { PluginContext } from '../context/plugin_context'; export type BreadcrumbTitle = | string + // @ts-expect-error upgrade typescript v4.9.5 | ((props: RouteComponentProps) => string) | null; diff --git a/x-pack/plugins/observability_solution/ux/public/components/app/rum_dashboard/ux_overview_fetchers.ts b/x-pack/plugins/observability_solution/ux/public/components/app/rum_dashboard/ux_overview_fetchers.ts index c15043181aa858..f4841d6a10d8e1 100644 --- a/x-pack/plugins/observability_solution/ux/public/components/app/rum_dashboard/ux_overview_fetchers.ts +++ b/x-pack/plugins/observability_solution/ux/public/components/app/rum_dashboard/ux_overview_fetchers.ts @@ -132,6 +132,7 @@ async function esQuery( dataStartPlugin: DataPublicPluginStart, query: IKibanaSearchRequest & { params: { index?: string } } ) { + // @ts-expect-error upgrade typescript v4.9.5 return new Promise>( (resolve, reject) => { const search$ = dataStartPlugin.search diff --git a/x-pack/plugins/osquery/common/utility_types.ts b/x-pack/plugins/osquery/common/utility_types.ts index 75a30adad3bf16..17e1bb65dfd648 100644 --- a/x-pack/plugins/osquery/common/utility_types.ts +++ b/x-pack/plugins/osquery/common/utility_types.ts @@ -20,8 +20,10 @@ export const unionWithNullType = (type: T) => export const stringEnum = (enumObj: T, enumName = 'enum') => new runtimeTypes.Type( enumName, + // @ts-expect-error upgrade typescript v4.9.5 (u): u is T[keyof T] => Object.values(enumObj).includes(u), (u, c) => + // @ts-expect-error upgrade typescript v4.9.5 Object.values(enumObj).includes(u) ? runtimeTypes.success(u as T[keyof T]) : runtimeTypes.failure(u, c), diff --git a/x-pack/plugins/security_solution/common/endpoint/generate_data.ts b/x-pack/plugins/security_solution/common/endpoint/generate_data.ts index 29d0edd91b23ed..7e93b7126ddbdb 100644 --- a/x-pack/plugins/security_solution/common/endpoint/generate_data.ts +++ b/x-pack/plugins/security_solution/common/endpoint/generate_data.ts @@ -1656,6 +1656,7 @@ export class EndpointDocGenerator extends BaseDataGenerator { path: '/package/endpoint/0.5.0', icons: [ { + // @ts-expect-error upgrade typescript v4.9.5 path: '/package/endpoint/0.5.0/img/logo-endpoint-64-color.svg', src: '/img/logo-endpoint-64-color.svg', size: '16x16', @@ -1740,6 +1741,7 @@ export class EndpointDocGenerator extends BaseDataGenerator { assets: {} as AssetsGroupedByServiceByType, icons: [ { + // @ts-expect-error upgrade typescript v4.9.5 path: '/package/endpoint/0.5.0/img/logo-endpoint-64-color.svg', src: '/img/logo-endpoint-64-color.svg', size: '16x16', diff --git a/x-pack/plugins/security_solution/common/utility_types.ts b/x-pack/plugins/security_solution/common/utility_types.ts index aaf1dfafb65756..bab5ecb40ce411 100644 --- a/x-pack/plugins/security_solution/common/utility_types.ts +++ b/x-pack/plugins/security_solution/common/utility_types.ts @@ -37,7 +37,7 @@ type NonAny = number | boolean | string | symbol | null; export const unionWithNullType = (type: T) => runtimeTypes.union([type, runtimeTypes.null]); -export const stringEnum = (enumObj: T, enumName = 'enum') => +export const stringEnum = (enumObj: T, enumName = 'enum') => new runtimeTypes.Type( enumName, (u): u is T[keyof T] => Object.values(enumObj).includes(u), diff --git a/x-pack/plugins/security_solution/public/common/components/page/manage_query.tsx b/x-pack/plugins/security_solution/public/common/components/page/manage_query.tsx index bfb439a8872ec0..ce8c9d3f681754 100644 --- a/x-pack/plugins/security_solution/public/common/components/page/manage_query.tsx +++ b/x-pack/plugins/security_solution/public/common/components/page/manage_query.tsx @@ -43,6 +43,7 @@ export function manageQuery( }); const otherProps = omit(['refetch', 'setQuery'], props); + // @ts-expect-error upgrade typescript v4.9.5 return ; }; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts index 39f5d56a3d4617..df4980a1e5df8f 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts @@ -84,6 +84,7 @@ export const getDnsTopDomainsLensAttributes: GetLensAttributes = ( params: { query: 'PTR', }, + // @ts-expect-error upgrade typescript v4.9.5 indexRefName: 'filter-index-pattern-0', }, query: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts index 4011b4cab9d412..cd427a862b71c7 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts @@ -29,6 +29,7 @@ export const kpiUserAuthenticationsMetricFailureLensAttributes: LensAttributes = meta: { alias: null, disabled: false, + // @ts-expect-error upgrade typescript v4.9.5 indexRefName: 'filter-index-pattern-0', key: 'query', negate: false, diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts index 2cbb7635d04cfe..a7efc44155eec0 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts @@ -89,6 +89,7 @@ export const kpiUserAuthenticationsAreaLensAttributes: LensAttributes = { meta: { alias: null, disabled: false, + // @ts-expect-error upgrade typescript v4.9.5 indexRefName: 'filter-index-pattern-0', key: 'query', negate: false, diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.ts index a4a1629e360de4..ff6937b1e43e41 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.ts @@ -84,6 +84,7 @@ export const kpiUserAuthenticationsBarLensAttributes: LensAttributes = { meta: { alias: null, disabled: false, + // @ts-expect-error upgrade typescript v4.9.5 indexRefName: 'filter-index-pattern-0', key: 'query', negate: false, diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts index 58ee89ac81b42f..c386fb71c0a5ce 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts @@ -29,6 +29,7 @@ export const kpiUserAuthenticationsMetricSuccessLensAttributes: LensAttributes = meta: { alias: null, disabled: false, + // @ts-expect-error upgrade typescript v4.9.5 indexRefName: 'filter-index-pattern-0', key: 'query', negate: false, diff --git a/x-pack/plugins/security_solution/public/common/lib/kibana/hooks.ts b/x-pack/plugins/security_solution/public/common/lib/kibana/hooks.ts index 714049872ee5d2..1efbec8e5b4a7f 100644 --- a/x-pack/plugins/security_solution/public/common/lib/kibana/hooks.ts +++ b/x-pack/plugins/security_solution/public/common/lib/kibana/hooks.ts @@ -71,7 +71,7 @@ export const convertArrayToCamelCase = (arrayOfSnakes: unknown[]): unknown[] => }, []); export const convertToCamelCase = (snakeCase: T): U => - Object.entries(snakeCase).reduce((acc, [key, value]) => { + Object.entries(snakeCase as never).reduce((acc, [key, value]) => { if (isArray(value)) { set(acc, camelCase(key), convertArrayToCamelCase(value)); } else if (isObject(value)) { diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/description_step/index.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/description_step/index.tsx index ebc25cadfa118c..f6f5957b54e429 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/description_step/index.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/description_step/index.tsx @@ -76,6 +76,7 @@ interface StepRuleDescriptionProps { columns?: 'multi' | 'single' | 'singleSplit'; data: unknown; indexPatterns?: DataViewBase; + // @ts-expect-error upgrade typescript v4.9.5 schema: FormSchema; } @@ -153,6 +154,7 @@ export const StepRuleDescription = memo(StepRuleDescriptionComponent); export const buildListItems = ( data: unknown, + // @ts-expect-error upgrade typescript v4.9.5 schema: FormSchema, filterManager: FilterManager, license: LicenseService, diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_table.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_table.tsx index 37b85aa42c918d..03a2485892dac6 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_table.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_table.tsx @@ -273,6 +273,7 @@ interface ActionsLogTableProps { isFlyout: boolean; loading: boolean; onChange: ({ + // @ts-expect-error upgrade typescript v4.9.5 page: _page, }: CriteriaWithPagination) => void; onShowActionDetails: (actionIds: string[]) => void; diff --git a/x-pack/plugins/security_solution/scripts/endpoint/common/agent_downloads_service.ts b/x-pack/plugins/security_solution/scripts/endpoint/common/agent_downloads_service.ts index 410ddd65cf8426..5e2e003b6096b8 100644 --- a/x-pack/plugins/security_solution/scripts/endpoint/common/agent_downloads_service.ts +++ b/x-pack/plugins/security_solution/scripts/endpoint/common/agent_downloads_service.ts @@ -198,6 +198,7 @@ const handleProcessInterruptions = async ( throw e; } + // @ts-expect-error upgrade typescript v4.9.5 if ('finally' in runnerResponse) { (runnerResponse as Promise).finally(() => { stopListeners(); diff --git a/x-pack/plugins/security_solution/server/endpoint/services/actions/clients/mocks.ts b/x-pack/plugins/security_solution/server/endpoint/services/actions/clients/mocks.ts index 76c06111e91733..c8e8662887602b 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/actions/clients/mocks.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/actions/clients/mocks.ts @@ -247,6 +247,7 @@ const createConnectorActionExecuteResponseMock = ( status: 'ok', }; + // @ts-expect-error upgrade typescript v4.9.5 return merge(result, overrides); }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.ts index a200afdd341998..64fa7995182c57 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.ts @@ -160,10 +160,13 @@ const statusToErrorMessage = (statusCode: number) => { export class SiemResponseFactory { constructor(private response: KibanaResponseFactory) {} + // @ts-expect-error upgrade typescript v4.9.5 error({ statusCode, body, headers }: CustomHttpResponseOptions) { + // @ts-expect-error upgrade typescript v4.9.5 const contentType: CustomHttpResponseOptions['headers'] = { 'content-type': 'application/json', }; + // @ts-expect-error upgrade typescript v4.9.5 const defaultedHeaders: CustomHttpResponseOptions['headers'] = { ...contentType, ...(headers ?? {}), diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/bulk_actions/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/bulk_actions/utils.ts index d624d9033f2998..42c062aba5d740 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/bulk_actions/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/bulk_actions/utils.ts @@ -18,4 +18,5 @@ export const isIndexPatternsBulkEditAction = (editAction: BulkActionEditType) => BulkActionEditTypeEnum.add_index_patterns, BulkActionEditTypeEnum.delete_index_patterns, BulkActionEditTypeEnum.set_index_patterns, + // @ts-expect-error upgrade typescript v4.9.5 ].includes(editAction); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/bulk_actions/validations.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/bulk_actions/validations.ts index 4a1aef9ed28d75..f387de9e3525ff 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/bulk_actions/validations.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/bulk_actions/validations.ts @@ -101,6 +101,7 @@ export const validateBulkEditRule = async ({ const istEditApplicableToImmutableRule = (edit: BulkActionEditPayload[]): boolean => { return edit.every(({ type }) => [BulkActionEditTypeEnum.set_rule_actions, BulkActionEditTypeEnum.add_rule_actions].includes( + // @ts-expect-error upgrade typescript v4.9.5 type ) ); diff --git a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_dev_tool_content/routes/read_prebuilt_dev_tool_content_route.ts b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_dev_tool_content/routes/read_prebuilt_dev_tool_content_route.ts index df819487e13b74..77553eca21d5cd 100644 --- a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_dev_tool_content/routes/read_prebuilt_dev_tool_content_route.ts +++ b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_dev_tool_content/routes/read_prebuilt_dev_tool_content_route.ts @@ -24,10 +24,13 @@ const getReadables = (dataPath: string) => fs.promises.readFile(dataPath, { enco class ConsoleResponseFactory { constructor(private response: KibanaResponseFactory) {} + // @ts-expect-error upgrade typescript v4.9.5 error({ statusCode, body, headers }: CustomHttpResponseOptions) { + // @ts-expect-error upgrade typescript v4.9.5 const contentType: CustomHttpResponseOptions['headers'] = { 'content-type': 'text/plain; charset=utf-8', }; + // @ts-expect-error upgrade typescript v4.9.5 const defaultedHeaders: CustomHttpResponseOptions['headers'] = { ...contentType, ...(headers ?? {}), @@ -36,6 +39,7 @@ class ConsoleResponseFactory { return this.response.custom({ headers: defaultedHeaders, statusCode, + // @ts-expect-error upgrade typescript v4.9.5 body, }); } diff --git a/x-pack/plugins/stack_connectors/public/connector_types/opsgenie/params.test.tsx b/x-pack/plugins/stack_connectors/public/connector_types/opsgenie/params.test.tsx index add2016bd97c2e..6b836f22511bc8 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/opsgenie/params.test.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/opsgenie/params.test.tsx @@ -218,6 +218,7 @@ describe('OpsgenieParamFields', () => { expect(screen.getByDisplayValue('123')).toBeInTheDocument(); rerender( + // @ts-expect-error upgrade typescript v4.9.5 { expect(screen.getByDisplayValue('456')).toBeInTheDocument(); rerender( + // @ts-expect-error upgrade typescript v4.9.5 { expect(editAction).toBeCalledTimes(1); rerender( + // @ts-expect-error upgrade typescript v4.9.5 ( ) { return (props: T) => ( }> + {/* @ts-expect-error upgrade typescript v4.9.5*/} ); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_alerts_filter_timeframe.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_alerts_filter_timeframe.test.tsx index ef73b3ab305c05..ea666d1f2dd3e1 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_alerts_filter_timeframe.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_alerts_filter_timeframe.test.tsx @@ -107,6 +107,7 @@ describe('action_alerts_filter_timeframe', () => { ); expect(alertsFilterTimeframeStart.exists()).toBeTruthy(); { + // @ts-expect-error upgrade typescript v4.9.5 const selectedDate: Moment = Reflect.get( alertsFilterTimeframeStart.first().props(), 'selected' @@ -117,6 +118,7 @@ describe('action_alerts_filter_timeframe', () => { const alertsFilterTimeframeEnd = wrapper.find('[data-test-subj="alertsFilterTimeframeEnd"]'); expect(alertsFilterTimeframeEnd.exists()).toBeTruthy(); { + // @ts-expect-error upgrade typescript v4.9.5 const selectedDate: Moment = Reflect.get( alertsFilterTimeframeEnd.first().props(), 'selected' diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_conditions.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_conditions.tsx index 2885d340134026..5828210d32598a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_conditions.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_conditions.tsx @@ -89,6 +89,7 @@ export const RuleConditions = ({ > {React.isValidElement(children) ? ( React.cloneElement(React.Children.only(children), { + // @ts-expect-error upgrade typescript v4.9.5 actionGroup, ...otherProps, }) diff --git a/yarn.lock b/yarn.lock index 709e1227bea944..7b02e6dc6c52ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -30080,10 +30080,10 @@ typescript-tuple@^2.2.1: dependencies: typescript-compare "^0.0.2" -typescript@4.7.4, typescript@^3.3.3333, typescript@^4.6.3, typescript@^5.0.4: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== +typescript@4.9.5, typescript@^3.3.3333, typescript@^4.6.3, typescript@^5.0.4: + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== typewise-core@^1.2, typewise-core@^1.2.0: version "1.2.0"