Skip to content

Commit 80a89d3

Browse files
committed
fix(language-core): improve mapping fault tolerance
1 parent ce9a052 commit 80a89d3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { getSlotsPropertyName } from '../../utils/shared';
33

44
export function generateGlobalTypes(vueCompilerOptions: VueCompilerOptions) {
55
const fnPropsType = `(K extends { $props: infer Props } ? Props : any)${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}`;
6-
return `
7-
; export const __VLS_globalTypesStart = {};
6+
return `export const __VLS_globalTypesStart = {};
87
declare global {
98
// @ts-ignore
109
type __VLS_IntrinsicElements = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.IntrinsicElements, __VLS_PickNotAny<globalThis.JSX.IntrinsicElements, Record<string, any>>>;
@@ -127,5 +126,6 @@ declare global {
127126
>;
128127
type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
129128
}
130-
export const __VLS_globalTypesEnd = {};`;
129+
export const __VLS_globalTypesEnd = {};
130+
`;
131131
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export function* generateScript(options: ScriptCodegenOptions): Generator<Code>
123123
yield generateScriptSetupImports(options.sfc.scriptSetup, options.scriptSetupRanges);
124124
yield* generateScriptSetup(options, ctx, options.sfc.scriptSetup, options.scriptSetupRanges);
125125
}
126+
yield endOfLine;
126127
if (options.globalTypes) {
127128
yield generateGlobalTypes(options.vueCompilerOptions);
128129
}

0 commit comments

Comments
 (0)