Error in signature of withReact
See original GitHub issueDescription 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 a BaseEditor
and the definition for withReact
requires a generic type T
that extends from ReactEditor
and then returns a union of T & ReactEditor
which doesn’t seem right.
Recording (Definition: slate-react/dist/plugin/with-react.d.ts)
Steps To reproduce the behavior:
- On a fresh TS app write
const editor = React.useMemo(() => withReact(createEditor()), []);
- See error
Expectation
I expect this is an error, and that withReact wants a generic extending BaseEditor
Environment
- Slate Version: [e.g. 0.60.15]
- Operating System: [N/A]
- Browser: [N/A]
- TypeScript Version: 4.1.5
Issue Analytics
- State:
- Created 2 years ago
- Reactions:18
- Comments:7 (1 by maintainers)
Top Results From Across the Web
How to solve customHooks call signature error in react with ...
I tried to solve call signature error but I couldn't figure it out. I try to use custom hooks which it takes a...
Read more >Azure Identity Authentication error "invalid signature" with ...
Azure Identity Authentication error "invalid signature" with React + Core Web API. Anyone know how I can go about finding out why I...
Read more >Getting started with React Signature component - Syncfusion
The following section explains the required steps to build the Signature component with its basic usage in step-by-step procedure. If playback doesn't begin ......
Read more >react-signature-canvas - npm
A React wrapper component around signature_pad. Unopinionated and heavily updated fork of react-signature-pad. Latest version: 1.0.6, ...
Read more >Sign and Verify messages with React.js and MetaMask
Learn how to generate and verify signatures from React.js code using MetaMask wallet.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is weird, the types are correct in the source https://github.com/ianstormtaylor/slate/blob/fece5c157099b5ddef9f6dc8d070f2fdb3724b90/packages/slate-react/src/plugin/with-react.ts#L27
However on the generated type definitions they are wrong
should be
Same here, but I was able to resolve like the implementation of @abdessamadelhamdany