Skip to content

withLists plugin expect editor of type SlateEditor #584

@aydinmisirzada

Description

@aydinmisirzada

I'm trying to use the @prezly/slate-lists package as per the usage guide (https://www.npmjs.com/package/@prezly/slate-lists). When I define my editor with

const [editor] = useState(() => withLists(schema)(withHistory(withReact(createEditor()))));

i'm getting Argument of type 'CustomEditor' is not assignable to parameter of type 'SlateEditor'. If I drilldown into the error, I see Type 'Node' is not assignable to type 'TDescendant'. Type 'BaseElement & AlignableElement & { type: CustomElementType.OrderedList; }' is not assignable to type 'TDescendant'. Type 'BaseElement & AlignableElement & { type: CustomElementType.OrderedList; }' is not assignable to type 'TText'. Property 'text' is missing in type 'BaseElement & AlignableElement & { type: CustomElementType.OrderedList; }' but required in type '{ text: string; }'

My custom editor type for slate is defined like CustomEditor: BaseEditor & ReactEditor & HistoryEditor.

How can I make it all work?

Packages used:

  • "slate": "0.112.0",
  • "slate-history": "0.110.3",
  • "slate-react": "0.112.1",
  • "@prezly/slate-lists": "0.118.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions