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
902 stars 85 forks source link

Building `preact-rectangles` template fails due to TS error from missing `space` prop #199

Closed fwextensions closed 9 months ago

fwextensions commented 9 months ago

I installed the template project:

npx --yes create-figma-plugin
? Select a template: plugin/preact-rectangles
info Copying "plugin/preact-rectangles" template...
info Resolving package versions...
info Installing dependencies...
success Done

Then ran build:

npm run build

> build
> build-figma-plugin --typecheck

info Typechecking...
error TypeScript error

    src/ui.tsx:31:6 - error TS2322: Type '{ children: Element[]; }' is not assignable to type 'IntrinsicAttributes & Omit<HTMLAttributes<HTMLDivElement>, keyof ContainerProps> & ContainerProps & Readonly<...>'.
      Property 'space' is missing in type '{ children: Element[]; }' but required in type 'ContainerProps'.

    31     <Container>
            ~~~~~~~~~

      node_modules/@create-figma-plugin/ui/lib/layout/container/container.d.ts:5:5
        5     space: ContainerSpace;
              ~~~~~
        'space' is declared here.

Looks like the <Container> in ui.tsx needs a space prop, though it seems like there should be a default for that on every component.

  return (
    <Container>
      <VerticalSpace space="large" />
yuanqing commented 9 months ago

This is likely because you’re running an outdated version of create-figma-plugin. The problem should go away if you run npx --yes create-figma-plugin@latest