diff --git a/src/client/custom-slate-types.d.ts b/src/client/custom-slate-types.d.ts new file mode 100644 index 0000000..dd61c22 --- /dev/null +++ b/src/client/custom-slate-types.d.ts @@ -0,0 +1,27 @@ +// This example is for an Editor with `ReactEditor` and `HistoryEditor` +import { BaseEditor, BaseRange } from 'slate' +import { HistoryEditor } from 'slate-history' + +export type CustomEditor = BaseEditor & HistoryEditor + +export type CustomElement = { + type?: string + children: CustomText[] +} + +export type CustomRange = { + isCaret?: boolean +} & BaseRange + +export type FormattedText = { text: string; bold?: boolean } + +export type CustomText = FormattedText + +declare module 'slate' { + interface CustomTypes { + Editor: CustomEditor + Element: CustomElement + Text: CustomText + Range: CustomRange + } +}