diff --git a/docs/concepts/11-typescript.md b/docs/concepts/11-typescript.md index 74fcb2f6a..2408498dc 100644 --- a/docs/concepts/11-typescript.md +++ b/docs/concepts/11-typescript.md @@ -11,10 +11,12 @@ To define a custom `Element` or `Text` type, extend the `CustomTypes` interface ```ts import { Descendant } from 'slate' +type CustomText = { text: string; bold: boolean; italic: boolean } + declare module 'slate' { interface CustomTypes { - Element: { type: 'paragraph'; children: Descendant[] } - Text: { text: string; bold: boolean; italic: boolean } + Element: { type: 'paragraph'; children: CustomText[] } + Text: CustomText } } ```