Skip to content
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

is dynamic component slot typing supported? #1425

Closed
exherb opened this issue Jun 8, 2022 · 2 comments
Closed

is dynamic component slot typing supported? #1425

exherb opened this issue Jun 8, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@exherb
Copy link

exherb commented Jun 8, 2022

version: 0.37.3

<component  :is="list">
  <template #default="scope">
    <slot v-bind="scope" />
  </template>
</component>

image

0.36.1 is not have this kind of lint issue.

@exherb
Copy link
Author

exherb commented Jun 9, 2022

here is the minimal reproductive repo

https://github.com/exherb/vite-project

Run npm run lint will report

➜ npm run lint

> vite-project@0.0.0 lint
> vue-tsc --project . --noEmit

src/components/HelloWorld.vue:9:10 - error TS2339: Property 'scope' does not exist on type '{ $: ComponentInternalInstance; $data: {}; $props: Partial<{}> & Omit<Readonly<ExtractPropTypes<{}>> & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>; ... 10 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...> | undefined): WatchStopHandle; } & Readonly<...> & Sha...'.

9       {{ scope.msg}}
           ~~~~~


Found 1 error in src/components/HelloWorld.vue

related files: https://github.com/exherb/vite-project/blob/a63855d160259faea3ff4f823e7201fa83ef0fa8/src/components/HelloWorld.vue#L7

got time to check this issue? thanks @johnsoncodehk

@mesqueeb
Copy link
Contributor

mesqueeb commented Jun 9, 2022

For me it also started happening recently.

Slot scope variables used to default to any I believe, causing no issues throughout our app, but now suddenly we have a million of these:

image

Manually typing as was suggested somewhere else also doesn't work.
Eg. #default="{ index }: { index: number }"

image

@johnsoncodehk any idea for a work around?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants