diff --git a/tsconfig.base.json b/tsconfig.base.json index 58a6237846a54..0aad8d6b9c124 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -39,6 +39,8 @@ // Resolve modules in the same way as Node.js. Aka make `require` works the // same in TypeScript as it does in Node.js. "moduleResolution": "node", + // "resolveJsonModule" allows for importing, extracting types from and generating .json files. + "resolveJsonModule": true, // Disallow inconsistently-cased references to the same file. "forceConsistentCasingInFileNames": true, // Forbid unused local variables as the rule was deprecated by ts-lint diff --git a/typings/index.d.ts b/typings/index.d.ts index 6d97aca4024c3..db6530d3f9e0b 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -35,15 +35,6 @@ declare module '*.svg' { export default content; } -// allow JSON files to be imported directly without lint errors -// see: https://github.com/palantir/tslint/issues/1264#issuecomment-228433367 -// and: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#arbitrary-expressions-are-forbidden-in-export-assignments-in-ambient-contexts -declare module '*.json' { - const json: any; - // eslint-disable-next-line import/no-default-export - export default json; -} - type MethodKeysOf = { [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never; }[keyof T]; diff --git a/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/__test__/List.test.tsx b/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/__test__/List.test.tsx index 84b72b62248b0..a5a38da3d5d88 100644 --- a/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/__test__/List.test.tsx +++ b/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/__test__/List.test.tsx @@ -43,6 +43,7 @@ describe('ErrorGroupOverview -> List', () => { + {/* @ts-expect-error invalid json props */} diff --git a/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx index 02e0e72826f3a..17dca4796ec74 100644 --- a/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx +++ b/x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverTransactionButton.test.tsx @@ -15,6 +15,7 @@ import mockTransaction from './mockTransaction.json'; describe('DiscoverTransactionLink component', () => { it('should render with data', () => { + // @ts-expect-error invalid json mock const transaction: Transaction = mockTransaction; expect( @@ -25,6 +26,7 @@ describe('DiscoverTransactionLink component', () => { describe('getDiscoverQuery', () => { it('should return the correct query params object', () => { + // @ts-expect-error invalid json mock const transaction: Transaction = mockTransaction; const result = getDiscoverQuery(transaction); expect(result).toMatchSnapshot(); diff --git a/x-pack/plugins/apm/server/lib/service_map/group_resource_nodes.test.ts b/x-pack/plugins/apm/server/lib/service_map/group_resource_nodes.test.ts index 2a9a2daf1fe47..23ef3f92e21a2 100644 --- a/x-pack/plugins/apm/server/lib/service_map/group_resource_nodes.test.ts +++ b/x-pack/plugins/apm/server/lib/service_map/group_resource_nodes.test.ts @@ -10,6 +10,7 @@ import expectedGroupedData from './mock_responses/group_resource_nodes_grouped.j describe('groupResourceNodes', () => { it('should group external nodes', () => { + // @ts-expect-error invalid json mock const responseWithGroups = groupResourceNodes(preGroupedData); expect(responseWithGroups.elements).toHaveLength( expectedGroupedData.elements.length @@ -17,7 +18,7 @@ describe('groupResourceNodes', () => { for (const element of responseWithGroups.elements) { const expectedElement = expectedGroupedData.elements.find( ({ data: { id } }: { data: { id: string } }) => id === element.data.id - ); + )!; expect(element).toMatchObject(expectedElement); } }); diff --git a/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts b/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts index e1a3ee1c9380d..9bd9c7b7a1040 100644 --- a/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts +++ b/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts @@ -31,6 +31,7 @@ describe('getServiceAnnotations', () => { searchAggregatedTransactions: false, }), { + // @ts-expect-error invalid json mock mockResponse: () => noVersions, } ); @@ -50,6 +51,7 @@ describe('getServiceAnnotations', () => { searchAggregatedTransactions: false, }), { + // @ts-expect-error invalid json mock mockResponse: () => oneVersion, } ); @@ -74,6 +76,7 @@ describe('getServiceAnnotations', () => { searchAggregatedTransactions: false, }), { + // @ts-expect-error invalid json mock mockResponse: () => responses.shift(), } ); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/server/demodata/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/server/demodata/index.ts index e29f1f511685e..102e6cdc726d5 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/server/demodata/index.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/server/demodata/index.ts @@ -61,6 +61,7 @@ export function demodata(): ExpressionFunctionDefinition< { id: 'project', name: 'project', meta: { type: 'string' } }, { id: 'percent_uptime', name: 'percent_uptime', meta: { type: 'number' } }, ], + // @ts-expect-error invalid json mock rows: sortBy(demoRows, 'time'), }; } else if (args.type === DemoRows.SHIRTS) { diff --git a/x-pack/plugins/canvas/shareable_runtime/components/__tests__/app.test.tsx b/x-pack/plugins/canvas/shareable_runtime/components/__tests__/app.test.tsx index 8786788e13fd3..f2bc07defb14b 100644 --- a/x-pack/plugins/canvas/shareable_runtime/components/__tests__/app.test.tsx +++ b/x-pack/plugins/canvas/shareable_runtime/components/__tests__/app.test.tsx @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -/* - One test relies on react-dom at a version of 16.9... it can be enabled - once renovate completes the upgrade. Relevant code has been commented out - in the meantime. +/* + One test relies on react-dom at a version of 16.9... it can be enabled + once renovate completes the upgrade. Relevant code has been commented out + in the meantime. */ import { mount, ReactWrapper } from 'enzyme'; diff --git a/x-pack/plugins/canvas/shareable_runtime/test/index.ts b/x-pack/plugins/canvas/shareable_runtime/test/index.ts index e07d94a6e1054..288dd0dc3a5be 100644 --- a/x-pack/plugins/canvas/shareable_runtime/test/index.ts +++ b/x-pack/plugins/canvas/shareable_runtime/test/index.ts @@ -11,4 +11,11 @@ import test from './workpads/test.json'; export * from './utils'; export type WorkpadNames = keyof typeof sharedWorkpads; -export const sharedWorkpads = { hello, austin, test }; +export const sharedWorkpads = { + // TODO: the automatic types for these JSON files are insufficient, and "austin" is so massive + // that Typescript refuses to type it. These should be converted to TypeScript and typed to fit + // the requirements. "austin" should also be reduced to the necessary data + hello: hello as any, + austin: austin as any, + test: test as any, +}; diff --git a/x-pack/plugins/infra/public/utils/apollo_client.ts b/x-pack/plugins/infra/public/utils/apollo_client.ts index 3c69ef4c98fac..41831a03cabbb 100644 --- a/x-pack/plugins/infra/public/utils/apollo_client.ts +++ b/x-pack/plugins/infra/public/utils/apollo_client.ts @@ -16,6 +16,7 @@ export const createApolloClient = (fetch: HttpHandler) => { const cache = new InMemoryCache({ addTypename: false, fragmentMatcher: new IntrospectionFragmentMatcher({ + // @ts-expect-error apollo-cache-inmemory types don't match actual introspection data introspectionQueryResultData, }), }); diff --git a/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx b/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx index 2568a6f40d326..e7330ca1dbe5d 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx +++ b/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx @@ -21,6 +21,7 @@ describe('AnnotationDescriptionList', () => { }); test('Initialization with annotation.', () => { + // @ts-expect-error mock data is too loosely typed const wrapper = shallowWithIntl(); expect(wrapper).toMatchSnapshot(); }); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/delete_action_name.test.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/delete_action_name.test.tsx index e033af6436130..63c4a0fe889f6 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/delete_action_name.test.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/delete_action_name.test.tsx @@ -51,6 +51,7 @@ describe('DeleteAction', () => { it('should display a tooltip when isDisabled prop is true.', () => { const { container } = render( + // @ts-expect-error mock data is incorrectly typed ); @@ -59,6 +60,7 @@ describe('DeleteAction', () => { it('should not display a tooltip when isDisabled prop is false.', () => { const { container } = render( + // @ts-expect-error mock data is incorrectly typed ); @@ -78,8 +80,12 @@ describe('DeleteAction', () => { {deleteAction.isModalVisible && } diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.test.ts b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.test.ts index 240e840363a1f..cf7e2890c1fd2 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.test.ts +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.test.ts @@ -10,6 +10,7 @@ import { getAnnotationLevels } from './timeseries_chart_annotations'; describe('Timeseries Chart Annotations: getAnnotationLevels()', () => { test('getAnnotationLevels()', () => { + // @ts-expect-error mock data is too loosely typed const levels = getAnnotationLevels(mockAnnotationsOverlap); expect(levels).toEqual({ A: 0, B: 1, C: 2, D: 2 }); }); diff --git a/x-pack/plugins/ml/server/models/job_validation/validate_time_range.test.ts b/x-pack/plugins/ml/server/models/job_validation/validate_time_range.test.ts index 12458af0521a9..674a19e1db488 100644 --- a/x-pack/plugins/ml/server/models/job_validation/validate_time_range.test.ts +++ b/x-pack/plugins/ml/server/models/job_validation/validate_time_range.test.ts @@ -144,6 +144,7 @@ describe('ML - validateTimeRange', () => { it('invalid time field', () => { const mockSearchResponseInvalid = cloneDeep(mockSearchResponse); + // @ts-expect-error creating intentionally invalid data mockSearchResponseInvalid.fieldCaps = undefined; const duration = { start: 0, end: 1 }; return validateTimeRange( diff --git a/x-pack/plugins/security_solution/public/common/lib/compose/helpers.test.ts b/x-pack/plugins/security_solution/public/common/lib/compose/helpers.test.ts index c34027648c896..01f74a5678be6 100644 --- a/x-pack/plugins/security_solution/public/common/lib/compose/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/common/lib/compose/helpers.test.ts @@ -26,6 +26,7 @@ describe('getLinks helper', () => { const mockCache = new InMemoryCache({ dataIdFromObject: () => null, fragmentMatcher: new IntrospectionFragmentMatcher({ + // @ts-expect-error apollo-cache-inmemory types don't match actual introspection data introspectionQueryResultData, }), }); diff --git a/x-pack/plugins/security_solution/public/common/lib/compose/kibana_compose.tsx b/x-pack/plugins/security_solution/public/common/lib/compose/kibana_compose.tsx index 30d3311a40b61..055e2591f7805 100644 --- a/x-pack/plugins/security_solution/public/common/lib/compose/kibana_compose.tsx +++ b/x-pack/plugins/security_solution/public/common/lib/compose/kibana_compose.tsx @@ -17,6 +17,7 @@ export function composeLibs(core: CoreStart): AppFrontendLibs { const cache = new InMemoryCache({ dataIdFromObject: () => null, fragmentMatcher: new IntrospectionFragmentMatcher({ + // @ts-expect-error apollo-cache-inmemory types don't match actual introspection data introspectionQueryResultData, }), }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_links.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_links.ts index fe6b44af202a8..4f389382dc475 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_links.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_links.ts @@ -7,8 +7,11 @@ import { uniq } from 'lodash/fp'; import { db } from 'suricata-sid-db'; +const has = (obj: T, key: string | number | symbol): key is keyof T => + Object.prototype.hasOwnProperty.call(obj, key); + export const getLinksFromSignature = (id: number): string[] => { - const refs = db[id]; + const refs = has(db, id) ? db[id] : null; if (refs != null) { return uniq(refs); } else { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.ts index cc22f34560c71..5ccde6d3eab97 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.ts @@ -8,7 +8,6 @@ import signalsMapping from './signals_mapping.json'; import ecsMapping from './ecs_mapping.json'; export const getSignalsTemplate = (index: string) => { - ecsMapping.mappings.properties.signal = signalsMapping.mappings.properties.signal; const template = { settings: { index: { @@ -24,7 +23,13 @@ export const getSignalsTemplate = (index: string) => { }, }, index_patterns: [`${index}-*`], - mappings: ecsMapping.mappings, + mappings: { + ...ecsMapping.mappings, + properties: { + ...ecsMapping.mappings.properties, + signal: signalsMapping.mappings.properties.signal, + }, + }, version: 1, }; return template; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_prepackaged_rules.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_prepackaged_rules.test.ts index ed1a239facf79..cf9a566cf4f90 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_prepackaged_rules.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_prepackaged_rules.test.ts @@ -33,12 +33,14 @@ describe('get_existing_prepackaged_rules', () => { }); test('should throw an exception if a pre-packaged rule is not valid', () => { + // @ts-expect-error intentionally invalid argument expect(() => getPrepackagedRules([{ not_valid_made_up_key: true }])).toThrow( 'name: "(rule name unknown)", rule_id: "(rule rule_id unknown)" within the folder rules/prepackaged_rules is not a valid detection engine rule. Expect the system to not work with pre-packaged rules until this rule is fixed or the file is removed. Error is: Invalid value "undefined" supplied to "description",Invalid value "undefined" supplied to "risk_score",Invalid value "undefined" supplied to "name",Invalid value "undefined" supplied to "severity",Invalid value "undefined" supplied to "type",Invalid value "undefined" supplied to "rule_id",Invalid value "undefined" supplied to "version", Full rule contents are:\n{\n "not_valid_made_up_key": true\n}' ); }); test('should throw an exception with a message having rule_id and name in it', () => { + // @ts-expect-error intentionally invalid argument expect(() => getPrepackagedRules([{ name: 'rule name', rule_id: 'id-123' }])).toThrow( 'name: "rule name", rule_id: "id-123" within the folder rules/prepackaged_rules is not a valid detection engine rule. Expect the system to not work with pre-packaged rules until this rule is fixed or the file is removed. Error is: Invalid value "undefined" supplied to "description",Invalid value "undefined" supplied to "risk_score",Invalid value "undefined" supplied to "severity",Invalid value "undefined" supplied to "type",Invalid value "undefined" supplied to "version", Full rule contents are:\n{\n "name": "rule name",\n "rule_id": "id-123"\n}' ); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_prepackaged_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_prepackaged_rules.ts index 354f8b90fae23..3d187d74432e8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_prepackaged_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_prepackaged_rules.ts @@ -15,6 +15,8 @@ import { AddPrepackagedRulesSchemaDecoded, } from '../../../../common/detection_engine/schemas/request/add_prepackaged_rules_schema'; import { BadRequestError } from '../errors/bad_request_error'; + +// TODO: convert rules files to TS and add explicit type definitions import { rawRules } from './prepackaged_rules'; /** @@ -49,5 +51,7 @@ export const validateAllPrepackagedRules = ( }); }; -export const getPrepackagedRules = (rules = rawRules): AddPrepackagedRulesSchemaDecoded[] => - validateAllPrepackagedRules(rules); +export const getPrepackagedRules = ( + // @ts-expect-error mock data is too loosely typed + rules: AddPrepackagedRulesSchema[] = rawRules +): AddPrepackagedRulesSchemaDecoded[] => validateAllPrepackagedRules(rules); diff --git a/x-pack/plugins/transform/public/app/common/transform_stats.test.ts b/x-pack/plugins/transform/public/app/common/transform_stats.test.ts index 342ca77a67b38..c030a24ff5c3c 100644 --- a/x-pack/plugins/transform/public/app/common/transform_stats.test.ts +++ b/x-pack/plugins/transform/public/app/common/transform_stats.test.ts @@ -12,11 +12,12 @@ import { getTransformProgress, isCompletedBatchTransform } from './transform_sta const getRow = (statsId: string) => { return { + // @ts-expect-error mock data does not actually match TransformListRow type ...(mockTransformListRow as TransformListRow), stats: { - ...mockTransformStats.transforms.find( - (stats: TransformListRow['stats']) => stats.id === statsId - ), + ...(mockTransformStats.transforms as Array).find( + (stats) => stats.id === statsId + )!, }, }; }; diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/start_action_name.test.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/start_action_name.test.tsx index 9c06675d69ca4..87e890b1b9718 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/start_action_name.test.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/start_action_name.test.tsx @@ -17,6 +17,7 @@ jest.mock('../../../../../app/app_dependencies'); describe('Transform: Transform List Actions ', () => { test('Minimal initialization', () => { + // @ts-expect-error mock data is too loosely typed const item: TransformListRow = transformListRow; const props: StartActionNameProps = { forceDisable: false, diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/stop_action_name.test.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/stop_action_name.test.tsx index 643e8c6126f0f..dcc26593de44b 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/stop_action_name.test.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/stop_action_name.test.tsx @@ -17,6 +17,7 @@ jest.mock('../../../../../app/app_dependencies'); describe('Transform: Transform List Actions ', () => { test('Minimal initialization', () => { + // @ts-expect-error mock data is too loosely typed const item: TransformListRow = transformListRow; const props: StopActionNameProps = { forceDisable: false, diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/common.test.ts b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/common.test.ts index f6708f7c36f26..9a6988445c73d 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/common.test.ts +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/common.test.ts @@ -15,14 +15,15 @@ describe('Transform: isCompletedBatchTransform()', () => { // check the transform config/state against the conditions // that will be used by isCompletedBatchTransform() // followed by a call to isCompletedBatchTransform() itself + // @ts-expect-error mock data is too loosely typed const row = mockTransformListRow as TransformListRow; expect(row.stats.checkpointing.last.checkpoint === 1).toBe(true); expect(row.config.sync === undefined).toBe(true); expect(row.stats.state === TRANSFORM_STATE.STOPPED).toBe(true); - expect(isCompletedBatchTransform(mockTransformListRow)).toBe(true); + expect(isCompletedBatchTransform(row)).toBe(true); // adapt the mock config to resemble a non-completed transform. row.stats.checkpointing.last.checkpoint = 0; - expect(isCompletedBatchTransform(mockTransformListRow)).toBe(false); + expect(isCompletedBatchTransform(row)).toBe(false); }); }); diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.test.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.test.tsx index 846d8a8ccd200..2a04668fe6017 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.test.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.test.tsx @@ -27,6 +27,7 @@ describe('Transform: Transform List ', () => { }); test('Minimal initialization', async () => { + // @ts-expect-error mock data is too loosely typed const item: TransformListRow = transformListRow; const { getByText, getByTestId } = render(); diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.test.tsx index 9ba5441604ddc..a4054bacba448 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/checkup_tab.test.tsx @@ -25,6 +25,7 @@ const defaultProps = { */ describe('CheckupTab', () => { test('render with deprecations', () => { + // @ts-expect-error mock data is too loosely typed expect(shallow()).toMatchSnapshot(); }); diff --git a/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.test.ts index 4d6e3f51a83a0..e0518e9447ec5 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.test.ts @@ -34,6 +34,7 @@ describe('getUpgradeAssistantStatus', () => { }); beforeEach(() => { + // @ts-expect-error mock data is too loosely typed deprecationsResponse = _.cloneDeep(fakeDeprecations); }); diff --git a/x-pack/test/api_integration/services/infraops_graphql_client.ts b/x-pack/test/api_integration/services/infraops_graphql_client.ts index 9eb2699431548..81f0ac8fad919 100644 --- a/x-pack/test/api_integration/services/infraops_graphql_client.ts +++ b/x-pack/test/api_integration/services/infraops_graphql_client.ts @@ -47,6 +47,7 @@ export function InfraOpsGraphQLClientFactoryProvider({ getService }: FtrProvider return new ApolloClient({ cache: new InMemoryCache({ fragmentMatcher: new IntrospectionFragmentMatcher({ + // @ts-expect-error apollo-cache-inmemory types don't match actual introspection data introspectionQueryResultData, }), }), diff --git a/x-pack/test/api_integration/services/security_solution_graphql_client.ts b/x-pack/test/api_integration/services/security_solution_graphql_client.ts index 0bcf94fdb7d3f..c592ced623467 100644 --- a/x-pack/test/api_integration/services/security_solution_graphql_client.ts +++ b/x-pack/test/api_integration/services/security_solution_graphql_client.ts @@ -46,6 +46,7 @@ export function SecuritySolutionGraphQLClientFactoryProvider({ getService }: Ftr return new ApolloClient({ cache: new InMemoryCache({ fragmentMatcher: new IntrospectionFragmentMatcher({ + // @ts-expect-error apollo-cache-inmemory types don't match actual introspection data introspectionQueryResultData, }), }), diff --git a/x-pack/tsconfig.json b/x-pack/tsconfig.json index d4722aba4882c..9a52aca381e87 100644 --- a/x-pack/tsconfig.json +++ b/x-pack/tsconfig.json @@ -15,7 +15,6 @@ "plugins/licensing/**/*" ], "compilerOptions": { - "outDir": ".", "paths": { "kibana/public": ["src/core/public"], "kibana/server": ["src/core/server"], diff --git a/x-pack/typings/index.d.ts b/x-pack/typings/index.d.ts index 73efee0dab2eb..2c7ae2961101c 100644 --- a/x-pack/typings/index.d.ts +++ b/x-pack/typings/index.d.ts @@ -33,12 +33,3 @@ declare module 'axios/lib/adapters/xhr'; type Writable = { -readonly [K in keyof T]: T[K]; }; - -// allow JSON files to be imported directly without lint errors -// see: https://github.com/palantir/tslint/issues/1264#issuecomment-228433367 -// and: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#arbitrary-expressions-are-forbidden-in-export-assignments-in-ambient-contexts -declare module '*.json' { - const json: any; - // eslint-disable-next-line import/no-default-export - export default json; -}