2019-01-03 18:17:21 +01:00
|
|
|
/*
|
|
|
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
|
|
* license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright
|
|
|
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
declare module '*.html' {
|
|
|
|
const template: string;
|
2019-04-05 18:45:23 +02:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2019-01-03 18:17:21 +01:00
|
|
|
export default template;
|
|
|
|
}
|
2019-03-18 16:11:15 +01:00
|
|
|
|
2020-03-31 19:41:00 +02:00
|
|
|
declare module '*.png' {
|
|
|
|
const content: string;
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
|
|
|
export default content;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module '*.svg' {
|
|
|
|
const content: string;
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-03-18 16:11:15 +01:00
|
|
|
type MethodKeysOf<T> = {
|
2019-07-03 21:36:44 +02:00
|
|
|
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
2019-03-18 16:11:15 +01:00
|
|
|
}[keyof T];
|
|
|
|
|
|
|
|
type PublicMethodsOf<T> = Pick<T, MethodKeysOf<T>>;
|
2019-06-28 13:34:41 +02:00
|
|
|
|
|
|
|
type MockedKeys<T> = { [P in keyof T]: jest.Mocked<T[P]> };
|
2019-07-30 00:51:45 +02:00
|
|
|
|
|
|
|
type DeeplyMockedKeys<T> = {
|
|
|
|
[P in keyof T]: T[P] extends (...args: any[]) => any
|
|
|
|
? jest.MockInstance<ReturnType<T[P]>, Parameters<T[P]>>
|
|
|
|
: DeeplyMockedKeys<T[P]>;
|
|
|
|
} &
|
|
|
|
T;
|
2020-03-31 19:41:00 +02:00
|
|
|
|
|
|
|
type Writable<T> = {
|
|
|
|
-readonly [K in keyof T]: T[K];
|
|
|
|
};
|