fix(types): instead of the inferred {}, allow any kind of props (#3638)

This commit is contained in:
Balazs 2020-04-20 15:15:04 +02:00 committed by GitHub
parent cf252605ad
commit 3f72f438a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,14 +146,14 @@ declare module 'netlify-cms-core' {
export interface CmsWidgetParam { export interface CmsWidgetParam {
name: string; name: string;
controlComponent: ComponentType; controlComponent: ComponentType<any>;
previewComponent?: ComponentType; previewComponent?: ComponentType<any>;
globalStyles: any; globalStyles: any;
} }
export interface CmsWidget { export interface CmsWidget {
control: ComponentType; control: ComponentType<any>;
preview?: ComponentType; preview?: ComponentType<any>;
globalStyles?: any; globalStyles?: any;
} }
@ -173,13 +173,13 @@ declare module 'netlify-cms-core' {
[name: string]: CmsRegistryBackend; [name: string]: CmsRegistryBackend;
}; };
templates: { templates: {
[name: string]: ComponentType; [name: string]: ComponentType<any>;
}; };
previewStyles: PreviewStyle[]; previewStyles: PreviewStyle[];
widgets: { widgets: {
[name: string]: CmsWidget; [name: string]: CmsWidget;
}; };
editorComponents: Map<string, ComponentType>; editorComponents: Map<string, ComponentType<any>>;
widgetValueSerializers: { widgetValueSerializers: {
[name: string]: CmsWidgetValueSerializer; [name: string]: CmsWidgetValueSerializer;
}; };
@ -191,11 +191,11 @@ declare module 'netlify-cms-core' {
export interface CMS { export interface CMS {
getBackend: (name: string) => CmsRegistryBackend | undefined; getBackend: (name: string) => CmsRegistryBackend | undefined;
getEditorComponents: () => Map<string, ComponentType>; getEditorComponents: () => Map<string, ComponentType<any>>;
getLocale: (locale: string) => CmsLocalePhrases | undefined; getLocale: (locale: string) => CmsLocalePhrases | undefined;
getMediaLibrary: (name: string) => CmsMediaLibrary | undefined; getMediaLibrary: (name: string) => CmsMediaLibrary | undefined;
getPreviewStyles: () => PreviewStyle[]; getPreviewStyles: () => PreviewStyle[];
getPreviewTemplate: (name: string) => ComponentType | undefined; getPreviewTemplate: (name: string) => ComponentType<any> | undefined;
getWidget: (name: string) => CmsWidget | undefined; getWidget: (name: string) => CmsWidget | undefined;
getWidgetValueSerializer: (widgetName: string) => CmsWidgetValueSerializer | undefined; getWidgetValueSerializer: (widgetName: string) => CmsWidgetValueSerializer | undefined;
init: (options?: InitOptions) => void; init: (options?: InitOptions) => void;
@ -204,11 +204,11 @@ declare module 'netlify-cms-core' {
registerLocale: (locale: string, phrases: CmsLocalePhrases) => void; registerLocale: (locale: string, phrases: CmsLocalePhrases) => void;
registerMediaLibrary: (mediaLibrary: CmsMediaLibrary, options?: CmsMediaLibraryOptions) => void; registerMediaLibrary: (mediaLibrary: CmsMediaLibrary, options?: CmsMediaLibraryOptions) => void;
registerPreviewStyle: (filePath: string, options?: PreviewStyleOptions) => void; registerPreviewStyle: (filePath: string, options?: PreviewStyleOptions) => void;
registerPreviewTemplate: (name: string, component: ComponentType<P>) => void; registerPreviewTemplate: (name: string, component: ComponentType<any>) => void;
registerWidget: ( registerWidget: (
widget: string | CmsWidgetParam, widget: string | CmsWidgetParam,
control?: ComponentType, control?: ComponentType<any>,
preview?: ComponentType, preview?: ComponentType<any>,
) => void; ) => void;
registerWidgetValueSerializer: ( registerWidgetValueSerializer: (
widgetName: string, widgetName: string,