diff --git a/packages/language-core/lib/codegen/script/scriptSetup.ts b/packages/language-core/lib/codegen/script/scriptSetup.ts index d586381247..df6bf091ce 100644 --- a/packages/language-core/lib/codegen/script/scriptSetup.ts +++ b/packages/language-core/lib/codegen/script/scriptSetup.ts @@ -464,7 +464,7 @@ function* generateModelEmit( yield `type __VLS_ModelEmit = {${newLine}`; for (const defineModel of defineModels) { const [propName, localName] = getPropAndLocalName(scriptSetup, defineModel); - yield `'update:${propName}': [${propName}:`; + yield `'update:${propName}': [value:`; yield* generateDefinePropType(scriptSetup, propName, localName, defineModel); yield `]${endOfLine}`; } diff --git a/packages/tsc/tests/__snapshots__/dts.spec.ts.snap b/packages/tsc/tests/__snapshots__/dts.spec.ts.snap index 405127c039..e26d792a89 100644 --- a/packages/tsc/tests/__snapshots__/dts.spec.ts.snap +++ b/packages/tsc/tests/__snapshots__/dts.spec.ts.snap @@ -91,7 +91,7 @@ type __VLS_PrettifyLocal = { exports[`vue-tsc-dts > Input: generic/component.vue, Output: generic/component.vue.d.ts 1`] = ` "declare const _default: (__VLS_props: NonNullable>["props"], __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable>["expose"], __VLS_setup?: Promise<{ props: __VLS_PrettifyLocal & Omit<{ - readonly "onUpdate:title"?: (title: string) => any; + readonly "onUpdate:title"?: (value: string) => any; readonly onBar?: (data: number) => any; } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:title" | "onBar"> & Partial<{}> & ({ title?: string; @@ -111,7 +111,7 @@ exports[`vue-tsc-dts > Input: generic/component.vue, Output: generic/component.v foo: number; }): any; }; - emit: ((e: "bar", data: number) => void) & ((evt: "update:title", title: string) => void); + emit: ((e: "bar", data: number) => void) & ((evt: "update:title", value: string) => void); }>) => import("vue").VNode & { @@ -127,7 +127,7 @@ type __VLS_PrettifyLocal = { exports[`vue-tsc-dts > Input: generic/custom-extension-component.cext, Output: generic/custom-extension-component.cext.d.ts 1`] = ` "declare const _default: (__VLS_props: NonNullable>["props"], __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable>["expose"], __VLS_setup?: Promise<{ props: __VLS_PrettifyLocal & Omit<{ - readonly "onUpdate:title"?: (title: string) => any; + readonly "onUpdate:title"?: (value: string) => any; readonly onBar?: (data: number) => any; } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:title" | "onBar"> & Partial<{}> & ({ title?: string; @@ -147,7 +147,7 @@ exports[`vue-tsc-dts > Input: generic/custom-extension-component.cext, Output: g foo: number; }): any; }; - emit: ((e: "bar", data: number) => void) & ((evt: "update:title", title: string) => void); + emit: ((e: "bar", data: number) => void) & ((evt: "update:title", value: string) => void); }>) => import("vue").VNode & { @@ -321,13 +321,13 @@ exports[`vue-tsc-dts > Input: reference-type-model/component.vue, Output: refere quxModifiers?: Record<'lazy' | 'trim', true>; }; declare const _default: import("vue").DefineComponent>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, { - "update:foo": (foo: number) => void; - "update:bar": (bar: string[]) => void; - "update:qux": (qux: string) => void; + "update:foo": (value: number) => void; + "update:bar": (value: string[]) => void; + "update:qux": (value: string) => void; }, string, import("vue").PublicProps, Readonly>> & Readonly<{ - "onUpdate:foo"?: (foo: number) => any; - "onUpdate:bar"?: (bar: string[]) => any; - "onUpdate:qux"?: (qux: string) => any; + "onUpdate:foo"?: (value: number) => any; + "onUpdate:bar"?: (value: string[]) => any; + "onUpdate:qux"?: (value: string) => any; }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>; export default _default; type __VLS_NonUndefinedable = T extends undefined ? never : T; diff --git a/test-workspace/tsc/passedFixtures/vue3/#4890/main.vue b/test-workspace/tsc/passedFixtures/vue3/#4890/main.vue new file mode 100644 index 0000000000..688ec89132 --- /dev/null +++ b/test-workspace/tsc/passedFixtures/vue3/#4890/main.vue @@ -0,0 +1,3 @@ + \ No newline at end of file