language-tools: Slots hack (`v-for="(_, slot) of $slots" #[slot]="scope"`) started showing errors
Hi,
Here’s the issue:
Text:
Element implicitly has an 'any' type because expression of type 'string | number' can't be used to index type 'Readonly<{ message?: ((args_0: VMessageSlot) => VNode<RendererNode, RendererElement, { [key: string]: any; }>[]) | undefined; clear?: (() => VNode<...>[]) | undefined; ... 12 more ...; 'no-data'?: (() => VNode<...>[]) | undefined; }> & MakeSlots<...>'.
No index signature with a parameter of type 'string' was found on type 'Readonly<{ message?: ((args_0: VMessageSlot) => VNode<RendererNode, RendererElement, { [key: string]: any; }>[]) | undefined; clear?: (() => VNode<...>[]) | undefined; ... 12 more ...; 'no-data'?: (() => VNode<...>[]) | undefined; }> & MakeSlots<...>'.ts(7053)
const slot: string | number
Isn’t this the way I’m supposed to go through all the slots?
Thank you.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 17 (2 by maintainers)
We apparently have a similar problem with Quasar, when creating a transparent wrapper around a Quasar own component I published a repro here: https://github.com/IlCallo/ts5-vue3.3-defineslots
You can see Volar errors into all SFC into
src/components
folder, even if they differ depending on the component It looks like that it gets particularly angry if all slots don’t have a scope parameter Only the error inExampleComponentOne
is actually correct