Browse Source

Up types

pull/4270/head
Artur Arseniev 5 years ago
parent
commit
6fbd1fe6e1
  1. 14
      index.d.ts

14
index.d.ts

@ -29,6 +29,10 @@ declare namespace Backbone {
}
declare module grapesjs {
type PluginOptions = Record<string, any>;
type Plugin<T extends PluginOptions = {}> = (editor: Editor, config: T) => void;
interface EditorConfig {
/** Selector which indicates where render the editor */
container?: string | HTMLElement;
@ -37,7 +41,7 @@ declare module grapesjs {
autorender?: boolean;
/** Array of plugins to execute on start */
plugins?: any[];
plugins?: (string | Plugin)[];
/** Custom options for plugins */
pluginsOpts?: Record<string, any>;
@ -3626,7 +3630,7 @@ declare module grapesjs {
* @param storage.load - Load method
* @param storage.store - Store method
*/
add(id: string, storage: IStorage): this;
add<T extends StorageOptions>(id: string, storage: IStorage<T>): this;
/**
* Returns storage by id
* @param id - Storage ID
@ -3684,9 +3688,9 @@ declare module grapesjs {
}
interface IStorage {
load: (options: StorageOptions) => Promise<ProjectData>;
store: (data: ProjectData, options: StorageOptions) => Promise<ProjectData>;
interface IStorage<T extends StorageOptions = {}> {
load: (options: T) => Promise<ProjectData>;
store: (data: ProjectData, options: T) => Promise<any>;
}
/**

Loading…
Cancel
Save