sanity
sanity copied to clipboard
Incorrect guide
Describe the bug
Hey folks, I’ve been following this guide, to add hotkeys to my portable text editor, but I’m getting a few errors.
The first is this one, which doesn’t prevent it from working, but it isn’t type safe. Type (props: PortableTextInputProps) => React.JSX.Element' is not assignable to type 'ComponentType<ArrayOfPrimitivesInputProps<string | number | boolean, ArraySchemaType<unknown>>> | undefined'.
The second one is a bit more annoying with PortableTextEditor
not being defined…
Any idea on how to solve this?
To Reproduce
Follow the steps in the linked guide above.
Expected behavior
I expect the guide to have accurate information and the sample code to work with no undefined
or other type errors.
Screenshots
Click for screenshots
Which versions of Sanity are you using?
package | version |
---|---|
@sanity/cli (global) | 3.27.1 (up to date) |
@sanity/astro | 2.2.0 (up to date) |
@sanity/code-input | 4.1.2 (up to date) |
@sanity/vision | 3.27.1 (up to date) |
sanity | 3.27.1 (up to date) |
What operating system are you using? MacOS - Linux Docker devcontainer
Which versions of Node.js / npm are you running? v21.5.0/10.2.4 respectively
i have same problem
Hi @b3nk3 thanks for reporting.
I was able to also reproduce it, will report to the team and keep this issue updated.
Until we get it fixed, you can add the following import in your component to solve the PortableTextEditor not defined
issue
import {PortableTextEditor} from '@sanity/portable-text-editor'
Thanks @pedrobonamin, this works for the second issue but the input
is still expecting a different type.
I'll keep my eyes on this issues but at least it works 😀...