[typescript] Create Ambient Types package (#129368)

* WIP

* tweak @kbn/ambient-ui-types for special usecase

* remove @types/ for ambient-ui-types, the package is a types package

* Split types; remove duplicate types in packages

* Adjust README

* Update CODEOWNERS

* Addressing feedback

* Move to tsconfig.base.json

* Fix missing types array in kbn/field-types

* Addressing errors

* Return declaration

* move storybook types to storybook specific package

* add codeowner for new package

Co-authored-by: spalger <spencer@elastic.co>
This commit is contained in:
Clint Andrew Hall 2022-04-06 19:21:24 -05:00 committed by GitHub
parent d89343d922
commit d92b7feeff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 239 additions and 113 deletions

42
typings/index.d.ts vendored
View file

@ -6,24 +6,6 @@
* Side Public License, v 1.
*/
declare module '*.html' {
const template: string;
// eslint-disable-next-line import/no-default-export
export default template;
}
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;
}
declare module 'axios/lib/adapters/xhr';
// Storybook references this module. It's @ts-ignored in the codebase but when
@ -38,27 +20,3 @@ declare module 'react-syntax-highlighter/dist/cjs/prism-light';
declare module 'monaco-editor/esm/vs/basic-languages/markdown/markdown';
declare module 'monaco-editor/esm/vs/basic-languages/css/css';
declare module 'monaco-editor/esm/vs/basic-languages/yaml/yaml';
// Storybook uses this module and its types are defined in the source but not in the type output
declare module 'file-system-cache' {
interface Options {
basePath?: string;
ns?: string | string[];
extension?: string;
}
class FileSystemCache {
constructor(options: Options);
path(key: string): string;
fileExists(key: string): Promise<boolean>;
ensureBasePath(): Promise<void>;
get(key: string, defaultValue?: any): Promise<any | typeof defaultValue>;
getSync(key: string, defaultValue?: any): any | typeof defaultValue;
set(key: string, value: any): Promise<{ path: string }>;
setSync(key: string, value: any): this;
remove(key: string): Promise<void>;
clear(): Promise<void>;
save(): Promise<{ paths: string[] }>;
load(): Promise<{ files: Array<{ path: string; value: any }> }>;
}
}