diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index e309d0e127df..e9aab9b47535 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -7,7 +7,10 @@ ] }, "include": [ - "**/*" + "**/*", + "../typings/**/*" ], - "exclude": [] + "exclude": [ + "../typings/jest.d.ts" + ] } diff --git a/x-pack/test/typings/hapi.d.ts b/x-pack/test/typings/hapi.d.ts deleted file mode 100644 index fc5ce09e5e61..000000000000 --- a/x-pack/test/typings/hapi.d.ts +++ /dev/null @@ -1,25 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import 'hapi'; - -import { XPackMainPlugin } from '../../legacy/plugins/xpack_main/server/xpack_main'; -import { SecurityPlugin } from '../../legacy/plugins/security'; -import { ActionsPlugin, ActionsClient } from '../../legacy/plugins/actions'; -import { AlertingPlugin, AlertsClient } from '../../legacy/plugins/alerting'; - -declare module 'hapi' { - interface Request { - getActionsClient?: () => ActionsClient; - getAlertsClient?: () => AlertsClient; - } - interface PluginProperties { - xpack_main: XPackMainPlugin; - security?: SecurityPlugin; - actions?: ActionsPlugin; - alerting?: AlertingPlugin; - } -} diff --git a/x-pack/test/typings/hapi_basic.d.ts b/x-pack/test/typings/hapi_basic.d.ts deleted file mode 100644 index b7b27a10599a..000000000000 --- a/x-pack/test/typings/hapi_basic.d.ts +++ /dev/null @@ -1,7 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -declare module '@hapi/basic'; diff --git a/x-pack/test/typings/index.d.ts b/x-pack/test/typings/index.d.ts deleted file mode 100644 index db6b2d38b2c2..000000000000 --- a/x-pack/test/typings/index.d.ts +++ /dev/null @@ -1,28 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -declare module '*.html' { - const template: string; - // eslint-disable-next-line import/no-default-export - export default template; -} - -declare module 'lodash/internal/toPath' { - function toPath(value: string | string[]): string[]; - export = toPath; -} - -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]; - -type PublicMethodsOf = Pick>; diff --git a/x-pack/typings/index.d.ts b/x-pack/typings/index.d.ts index 2413f986922e..7696ddbfd73c 100644 --- a/x-pack/typings/index.d.ts +++ b/x-pack/typings/index.d.ts @@ -27,15 +27,6 @@ type Writable = { -readonly [K in keyof T]: T[K]; }; -type MockedKeys = { [P in keyof T]: jest.Mocked> }; - -type DeeplyMockedKeys = { - [P in keyof T]: T[P] extends (...args: any[]) => any - ? jest.MockInstance, Parameters> - : DeeplyMockedKeys; -} & - T; - // 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 diff --git a/x-pack/typings/jest_styled_components.d.ts b/x-pack/typings/jest.d.ts similarity index 75% rename from x-pack/typings/jest_styled_components.d.ts rename to x-pack/typings/jest.d.ts index 86f82ffb013c..5d2aa51284e5 100644 --- a/x-pack/typings/jest_styled_components.d.ts +++ b/x-pack/typings/jest.d.ts @@ -4,8 +4,16 @@ * you may not use this file except in compliance with the Elastic License. */ -// https://github.com/styled-components/jest-styled-components/issues/264 +type MockedKeys = { [P in keyof T]: jest.Mocked> }; +type DeeplyMockedKeys = { + [P in keyof T]: T[P] extends (...args: any[]) => any + ? jest.MockInstance, Parameters> + : DeeplyMockedKeys; +} & + T; + +// https://github.com/styled-components/jest-styled-components/issues/264 declare namespace jest { interface AsymmetricMatcher { $$typeof: Symbol; //eslint-disable-line