yuanqing / create-figma-plugin

:battery: The comprehensive toolkit for developing plugins and widgets for Figma and FigJam
https://yuanqing.github.io/create-figma-plugin/
MIT License
948 stars 91 forks source link

Type error when try to use plugin/react-editor #207

Closed insanicly closed 11 months ago

insanicly commented 11 months ago

Hi everyone, thank you for providing this amazing tool. I having problems working with it.

When I simply try to follow the quick start from the given link from the read me, it simply fails.

Here are my steps:

npx --yes create-figma-plugin (select plugin/react-editor from the options) cd react-editor/ npm run watch

it fails with this error:

success Built in 0.124s info Typechecking... error TypeScript error

src/ui.tsx:30:10 - error TS2786: 'Editor' cannot be used as a JSX component.
  Its type 'typeof Editor' is not a valid JSX element type.
    Type 'typeof Editor' is not assignable to type 'ComponentClass<any, {}>'.
      Types of property 'contextType' are incompatible.
        Type 'import("/Users/alper/My-projects/react-editor/node_modules/@types/react/index").Context<any> | undefined' is not assignable to type 'preact.Context<any> | undefined'.
          Type 'import("/Users/alper/My-projects/react-editor/node_modules/@types/react/index").Context<any>' is not assignable to type 'preact.Context<any>'.
            Types of property 'Consumer' are incompatible.
              Type 'import("/Users/alper/My-projects/react-editor/node_modules/@types/react/index").Consumer<any>' is not assignable to type 'preact.Consumer<any>'.
                Types of parameters 'props' and 'props' are incompatible.
                  Type 'RenderableProps<{ children: (value: any) => ComponentChildren; }, any>' is not assignable to type 'ConsumerProps<any>'.
                    Types of property 'children' are incompatible.
                      Type '((value: any) => ComponentChildren) & ComponentChildren' is not assignable to type '(value: any) => ReactNode'.
                        Type '((value: any) => ComponentChildren) & string' is not assignable to type '(value: any) => ReactNode'.
                          Type 'ComponentChildren' is not assignable to type 'ReactNode'.
                            Type 'bigint' is not assignable to type 'ReactNode'.

30         <Editor
            ~~~~~~

success Typechecked in 1.195s

What can be done to overcome this error?

thank you for your help in advance.

morphine-cake commented 11 months ago

Did you find any workaround for this one?

yuanqing commented 11 months ago

Fixed in 3.1.0

$ npx --yes -- create-figma-plugin@3.1.0 --template plugin/react-editor