-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in signature of withReact #4144
Comments
@ChildishForces I had the same issue, but was able to fix it by defining a custom Check out the typescript docs https://github.com/ianstormtaylor/slate/blob/main/docs/concepts/11-typescript.md#defining-editor-element-and-text-types |
Update: https://github.com/ianstormtaylor/slate/blob/main/docs/concepts/12-typescript.md or https://docs.slatejs.org/concepts/12-typescript |
This is weird, the types are correct in the source
However on the generated type definitions they are wrong
should be
|
I'm facing the same issue, seems like incompatible types, with some missing properties
as it doesn't seem to cause any compilation issues |
Same here, but I was able to resolve like the implementation of @abdessamadelhamdany |
Hi @iamdddev I think you just need to add custom types like in this example: https://github.com/ianstormtaylor/slate/blob/main/site/examples/custom-types.d.ts Slate has a little different view of how typescript types implemented |
There is indeed a problem with I've filed a PR to fix it: #5091 |
Description
Attempting to start a new Typescript project on @next is causing interface issues from the 1st line.
const editor = React.useMemo(() => withReact(createEditor()), []);
Immediately complains because
createEditor()
returns aBaseEditor
and the definition forwithReact
requires a generic typeT
that extends fromReactEditor
and then returns a union ofT & ReactEditor
which doesn't seem right.Recording
(Definition: slate-react/dist/plugin/with-react.d.ts)
Steps
To reproduce the behavior:
const editor = React.useMemo(() => withReact(createEditor()), []);
Expectation
I expect this is an error, and that withReact wants a generic extending
BaseEditor
Environment
The text was updated successfully, but these errors were encountered: