million: bug: Module parse failed: Shorthand property assignments are valid only in destructuring patterns

Describe the bug This seems a typescript error when you try to use a interface / type in a block.

To Reproduce Steps to reproduce the behavior: 1. import { For, block } from ‘million/react’ ( “million”: “^2.4.8-beta.3”) because if I try to use import { block } from “million/react-server”; I receive the next message: Cannot find module ‘million/react-server’ or its corresponding type declarations.

2. Create a type or interface:

type SidebarProps = {
    title: string;
    bannerImage: string;
    sidebarItems: any[];
    type: "flat" | "children"
    userName?: string;
    userImage?: string;
}

3. Use the type in the component: Component:

const Sidebar: React.FC<SidebarProps> = ({ title, bannerImage, sidebarItems, type = "flat", userName = "", userImage = "" }) => { 
....
};

4. Implement million block:

const BlockComponent = block<SidebarProps>(Sidebar);
export default BlockComponent;

Expected behavior The component should be displayed

Screenshots image

Device (please complete the following information):

  • Browser chrome, firefox, etc

Additional context Error message: (137:16) File was processed with these loaders:

./node_modules/next/dist/build/webpack/loaders/next-flight-client-module-loader.js ./node_modules/next/dist/build/webpack/loaders/next-swc-loader.js ./node_modules/unplugin/dist/webpack/loaders/transform.js You may need an additional loader to handle the result of these loaders. | bannerImage, | sidebarItems, type=“flat”, | userName=“”, | userImage=“”

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

is the same issue without props in block:

image