diff --git a/types/slate-react/index.d.ts b/types/slate-react/index.d.ts index 5daa7dc526..40ece4edba 100644 --- a/types/slate-react/index.d.ts +++ b/types/slate-react/index.d.ts @@ -111,14 +111,17 @@ export interface Plugin extends CorePlugin { onSelect?: EventHook; } +export type PluginOrPlugins = Plugin | Plugins; +export interface Plugins extends Array {} + export interface BasicEditorProps { value: Value; autoCorrect?: boolean; autoFocus?: boolean; className?: string; - onChange?: (change: { operations: Immutable.List, value: Value }) => any; + onChange?: (change: { operations: Immutable.List; value: Value }) => any; placeholder?: any; - plugins?: Plugin[]; + plugins?: Plugins; readOnly?: boolean; role?: string; schema?: SchemaProperties; diff --git a/types/slate-react/slate-react-tests.tsx b/types/slate-react/slate-react-tests.tsx index 1251d3ab53..f49a6ffefa 100644 --- a/types/slate-react/slate-react-tests.tsx +++ b/types/slate-react/slate-react-tests.tsx @@ -32,6 +32,7 @@ class MyPlugin implements Plugin { } const myPlugin = new MyPlugin(); +const plugins = [myPlugin, [myPlugin, [myPlugin]]]; interface MyEditorState { value: Value; @@ -47,11 +48,15 @@ class MyEditor extends React.Component { }; } render() { - return ; + return ( + + ); } }