Subscribe on changes!

Script setup "withDefaults" generates wrong code

avatar
Sep 3rd 2021

Version

3.2.8

Reproduction link

github.com

Steps to reproduce

  1. Create file with script setup
  2. paste
withDefaults(
  defineProps<{
    phones: Stored<Phone[]>;
    title?: string;
    callable?: boolean;
  }>(),
  {
    title: "Телефоны",
  }
);

To reproduce with git reproduction, run npm run build after npm install

What is expected?

compiled code:

const props = __props as { phones: Stored<Phone[]>, title: string, callable?: boolean }

What is actually happening?

compiled code:

const props = __props as { phones: Stored<Phone[]>;, title: string, callable?: boolean; }

esbuild is giving me this error, but it goes from wrong compiled code