diff --git a/packages/slate-history/src/with-history.ts b/packages/slate-history/src/with-history.ts index 8663b07d1..734547252 100644 --- a/packages/slate-history/src/with-history.ts +++ b/packages/slate-history/src/with-history.ts @@ -7,8 +7,8 @@ import { HistoryEditor } from './history-editor' * editor as operations are applied to it, using undo and redo stacks. */ -export const withHistory = (editor: Editor): HistoryEditor => { - const e = editor as HistoryEditor +export const withHistory = (editor: T) => { + const e = editor as T & HistoryEditor const { apply } = e e.history = { undos: [], redos: [] } diff --git a/packages/slate-react/src/plugin/with-react.ts b/packages/slate-react/src/plugin/with-react.ts index db9218df1..1441aa64b 100644 --- a/packages/slate-react/src/plugin/with-react.ts +++ b/packages/slate-react/src/plugin/with-react.ts @@ -9,8 +9,8 @@ import { EDITOR_TO_ON_CHANGE, NODE_TO_KEY } from '../utils/weak-maps' * `withReact` adds React and DOM specific behaviors to the editor. */ -export const withReact = (editor: Editor): ReactEditor => { - const e = editor as ReactEditor +export const withReact = (editor: T) => { + const e = editor as T & ReactEditor const { apply, onChange } = e e.apply = (op: Operation) => {