Skip to content

Commit b253b2c

Browse files
committed
fix: ignore error to unsupported component types (#553)
1 parent 6eaf1d3 commit b253b2c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/vscode-vue-languageservice/src/use/useSfcTemplateScript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function useSfcTemplateScript(
8383
codeGen.addText('/* Components */\n');
8484
codeGen.addText('declare var __VLS_ownComponent: __VLS_types.SelfComponent<typeof __VLS_name, typeof __VLS_component & { __VLS_raw: typeof __VLS_component, __VLS_options: typeof __VLS_options, __VLS_slots: typeof __VLS_slots }>;\n');
8585
codeGen.addText('declare var __VLS_wrapComponents: __VLS_types.GlobalComponents & typeof __VLS_vmUnwrap.components & __VLS_types.PickComponents<typeof __VLS_ctxRaw> & typeof __VLS_ownComponent;\n'); // has __VLS_options
86-
codeGen.addText('declare var __VLS_rawComponents: __VLS_types.ExtractRawComponents<typeof __VLS_wrapComponents> & JSX.IntrinsicElements;\n'); // sort by priority
86+
codeGen.addText('declare var __VLS_rawComponents: __VLS_types.ConvertInvalidComponents<__VLS_types.ExtractRawComponents<typeof __VLS_wrapComponents>> & JSX.IntrinsicElements;\n'); // sort by priority
8787

8888
/* CSS Module */
8989
codeGen.addText('/* CSS Module */\n');

packages/vscode-vue-languageservice/src/utils/localTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export type GlobalAttrsBase = VNodeProps & AllowedComponentProps;
136136
export type GlobalAttrs = GlobalAttrsBase & HTMLAttributes;
137137
export type DefinePropsToOptions<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? { type: PropType<NonUndefinedable<T[K]>> } : { type: PropType<T[K]>, required: true } };
138138
export type PickComponents<T> = ComponentKeys<T> extends keyof T ? Pick<T, ComponentKeys<T>> : T;
139+
export type ConvertInvalidComponents<T> = { [K in keyof T]: IsComponent<T[K]> extends true ? T[K] : any };
139140
export type SelfComponent<N, C> = string extends N ? {} : N extends string ? { [P in N]: C } : {};
140141
141142
export ${genConstructorOverloads()}

0 commit comments

Comments
 (0)