Skip to content

Commit c25d7e9

Browse files
committed
refactor(language-core): rename __VLS_unknownProps to __VLS_PROPS_FALLBACK
1 parent 342cf3b commit c25d7e9

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

packages/language-core/lib/codegen/globalTypes.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function generateGlobalTypes(options: VueCompilerOptions) {
2121
}
2222
text += `
2323
; declare global {
24-
var __VLS_unknownProps: ${checkUnknownProps ? '{}' : 'Record<string, unknown>'};
24+
${checkUnknownProps ? '' : 'var __VLS_PROPS_FALLBACK: Record<string, unknown>;'}
2525
2626
const __VLS_directiveBindingRestFields: { instance: null, oldValue: null, modifiers: any, dir: any };
2727
const __VLS_unref: typeof import('${lib}').unref;
@@ -59,7 +59,9 @@ export function generateGlobalTypes(options: VueCompilerOptions) {
5959
? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
6060
: T extends (props: infer P, ...args: any) => any ? P
6161
: {};
62-
type __VLS_FunctionalComponent<T> = (props: (T extends { $props: infer Props } ? Props : {}) & typeof __VLS_unknownProps, ctx?: any) => ${
62+
type __VLS_FunctionalComponent<T> = (props: (T extends { $props: infer Props } ? Props : {})${
63+
checkUnknownProps ? '' : ' & Record<string, unknown>'
64+
}, ctx?: any) => ${
6365
target >= 3.3
6466
? `import('${lib}/jsx-runtime').JSX.Element`
6567
: `globalThis.JSX.Element`

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function* generateScriptSetup(
9797
+ ` & import('${options.vueCompilerOptions.lib}').AllowedComponentProps`
9898
+ ` & import('${options.vueCompilerOptions.lib}').ComponentCustomProps`
9999
: `globalThis.JSX.IntrinsicAttributes`
100-
} & (typeof globalThis extends { __VLS_unknownProps: infer P } ? P : {})${endOfLine}`
100+
} & (typeof globalThis extends { __VLS_PROPS_FALLBACK: infer P } ? P : {})${endOfLine}`
101101
+ ` expose: (exposed: ${
102102
scriptSetupRanges.defineExpose
103103
? `import('${options.vueCompilerOptions.lib}').ShallowUnwrapRef<typeof __VLS_exposed>`

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ exports[`vue-tsc-dts > Input: generic/component.vue, Output: generic/component.v
6464
"onUpdate:title"?: (value: string) => any;
6565
onBar?: (data: number) => any;
6666
}> & import("vue").PublicProps & (typeof globalThis extends {
67-
__VLS_unknownProps: infer P;
67+
__VLS_PROPS_FALLBACK: infer P;
6868
} ? P : {});
6969
expose: (exposed: import("vue").ShallowUnwrapRef<{
7070
baz: number;
@@ -97,7 +97,7 @@ exports[`vue-tsc-dts > Input: generic/custom-extension-component.cext, Output: g
9797
"onUpdate:title"?: (value: string) => any;
9898
onBar?: (data: number) => any;
9999
}> & import("vue").PublicProps & (typeof globalThis extends {
100-
__VLS_unknownProps: infer P;
100+
__VLS_PROPS_FALLBACK: infer P;
101101
} ? P : {});
102102
expose: (exposed: import("vue").ShallowUnwrapRef<{
103103
baz: number;

0 commit comments

Comments
 (0)