fix: custom slate types definition

This commit is contained in:
Eric Maciel 2022-03-07 16:17:59 -05:00
parent 66e779df2d
commit d2d2a85efc

27
src/client/custom-slate-types.d.ts vendored Normal file
View File

@ -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
}
}