-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error TS2322
using Vue's dynamically named Slots
#325
Comments
TS2322
using Vue's dynamically named Slots
I had to look up what Slots were as I'm not too familiar with Vue, seems like these are the equivalent of React's Slots type coercion
You can try What does
|
|
@Shenor do you have a (minimal) reproduction of this issue? I've been meticulously going through all the issues and doing root cause analyses and fixing most of them, but I can't really investigate this further without a reproduction. |
@Shenor I created a minimal repro here and was unable to reproduce the error you received. rpt2 does not throw any error and neither does It's possible that there's something missing in my reproduction, but given the lack of details here, this is all I was able to come up with. Without more input from you, there's nothing more that we can do here, and given the current inability to reproduce, it doesn't seem like this is an error within rpt2 either, but rather something in your environment, at least as far as I can tell given the current repro I created. |
Closing this as stale as OP has not responded in nearly a month and a reproduction has been unsuccessful. Can re-open if a minimal repro is provided. |
the issue I have is somewhat related. but it occurs when actually using a conditional template. in essence, by doing: <my-component>
<template v-if="true" #foo> Bar </template>
</my-component> This is being transpiled to: function render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_my_component = resolveComponent("my-component");
return (openBlock(), createBlock(_component_my_component, null, createSlots({ _: 2 /* DYNAMIC */ }, [
{
name: "foo",
fn: withCtx(() => [
_hoisted_1
])
}
]), 1024 /* DYNAMIC_SLOTS */))
} Where I get the following error: Not really sure the issue is on rpt2 or on vue side, as it seems the transpiled/generated code doesn't match the interface of For the record, I can get away with it by declaring something like this: // types/vue.d.ts
import 'vue'
declare module 'vue' {
function createSlots(
slots: Record<string, any>,
dynamicSlots: (any | any[] | undefined)[]
): Record<string, any>
} Which is fine for my case as I never call the |
@tiagoskaneta thanks for providing a detailed example and repro! That definitely looks like a problem on the
So either there's some wrapper code that |
This issue still occure when I try to add
With the newest version of Vue. It happens only when building for prod. typescript check doesn't see any issue |
hey, did you find a fix? it's happening to me too |
What happens and why it is wrong
When assembling a project with dynamic slots, the following error appears:
The problem arises specifically because of this code. In its absence, the assembly is successful:
:rollup.config.js
:tsconfig.json
I tried to set the type of slots, but all to no avail.
or
I don't understand how this can be fixed.
The text was updated successfully, but these errors were encountered: