Skip to content

Commit 27772e5

Browse files
committed
chore: delete tests for Vue 3.4 (#5871)
1 parent 6ac4938 commit 27772e5

File tree

15 files changed

+68
-386
lines changed

15 files changed

+68
-386
lines changed

packages/language-core/lib/codegen/script/scriptSetup.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export function* generateGeneric(
5252
yield* body;
5353

5454
const propTypes: string[] = [];
55+
const emitTypes: string[] = [];
5556
const { vueCompilerOptions } = options;
5657

5758
if (ctx.generatedTypes.has(names.PublicProps)) {
@@ -78,8 +79,6 @@ export function* generateGeneric(
7879
if (options.templateCodegen?.generatedTypes.has(names.InheritedAttrs)) {
7980
propTypes.push(names.InheritedAttrs);
8081
}
81-
82-
const emitTypes: string[] = [];
8382
if (scriptSetupRanges.defineEmits) {
8483
emitTypes.push(`typeof ${scriptSetupRanges.defineEmits.name ?? names.emit}`);
8584
}
@@ -88,15 +87,17 @@ export function* generateGeneric(
8887
}
8988

9089
yield `return {} as {${newLine}`;
91-
yield ` props: ${propTypes.length ? `${ctx.localTypes.PrettifyLocal}<${propTypes.join(` & `)}> & ` : ``}${
92-
vueCompilerOptions.target >= 3.4
93-
? `import('${vueCompilerOptions.lib}').PublicProps`
94-
: vueCompilerOptions.target >= 3
95-
? `import('${vueCompilerOptions.lib}').VNodeProps`
96-
+ ` & import('${vueCompilerOptions.lib}').AllowedComponentProps`
97-
+ ` & import('${vueCompilerOptions.lib}').ComponentCustomProps`
98-
: `globalThis.JSX.IntrinsicAttributes`
99-
}`;
90+
yield ` props: `;
91+
yield vueCompilerOptions.target >= 3.4
92+
? `import('${vueCompilerOptions.lib}').PublicProps`
93+
: vueCompilerOptions.target >= 3
94+
? `import('${vueCompilerOptions.lib}').VNodeProps`
95+
+ ` & import('${vueCompilerOptions.lib}').AllowedComponentProps`
96+
+ ` & import('${vueCompilerOptions.lib}').ComponentCustomProps`
97+
: `globalThis.JSX.IntrinsicAttributes`;
98+
if (propTypes.length) {
99+
yield ` & ${ctx.localTypes.PrettifyLocal}<${propTypes.join(` & `)}>`;
100+
}
100101
if (!vueCompilerOptions.checkUnknownProps) {
101102
yield ` & (typeof globalThis extends { ${names.PROPS_FALLBACK}: infer P } ? P : {})`;
102103
}

packages/tsc/tests/__snapshots__/dts.spec.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ export default _default;
167167

168168
exports[`Input: generic/component.vue, Output: generic/component.vue.d.ts 1`] = `
169169
"declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
170-
props: __VLS_PrettifyLocal<({
170+
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
171171
foo: number;
172172
} & {
173173
title?: string;
174174
}) & {
175175
"onUpdate:title"?: (value: string) => any;
176176
onBar?: (data: number) => any;
177-
}> & import("vue").PublicProps & (typeof globalThis extends {
177+
}> & (typeof globalThis extends {
178178
__VLS_PROPS_FALLBACK: infer P;
179179
} ? P : {});
180180
expose: (exposed: import("vue").ShallowUnwrapRef<{
@@ -202,14 +202,14 @@ type __VLS_PrettifyLocal<T> = (T extends any ? {
202202
203203
exports[`Input: generic/custom-extension-component.cext, Output: generic/custom-extension-component.cext.d.ts 1`] = `
204204
"declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
205-
props: __VLS_PrettifyLocal<({
205+
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
206206
foo: number;
207207
} & {
208208
title?: string;
209209
}) & {
210210
"onUpdate:title"?: (value: string) => any;
211211
onBar?: (data: number) => any;
212-
}> & import("vue").PublicProps & (typeof globalThis extends {
212+
}> & (typeof globalThis extends {
213213
__VLS_PROPS_FALLBACK: infer P;
214214
} ? P : {});
215215
expose: (exposed: import("vue").ShallowUnwrapRef<{

0 commit comments

Comments
 (0)