sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Incorrect guide

Open b3nk3 opened this issue 1 year ago • 3 comments

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

CleanShot 2024-02-02 at 19 15 34

CleanShot 2024-02-02 at 19 15 58

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

b3nk3 avatar Feb 02 '24 19:02 b3nk3

i have same problem

lotarbo avatar Feb 06 '24 13:02 lotarbo

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'

pedrobonamin avatar Feb 07 '24 11:02 pedrobonamin

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 😀...

b3nk3 avatar Feb 08 '24 19:02 b3nk3