Skip to content

Conversation

@RayGuo-ergou
Copy link
Contributor

@RayGuo-ergou RayGuo-ergou commented May 13, 2024

Description

Export typo MultipleCalendarRootProps and SingleCalendarRootProps used by CalendarRootProps.

Motivation

I was working on build an UI library based on radix-vue/shadcn-vue, this error shows up when build:

image

This seems a typescript limitation that interface of type alias should also be exposed.

I have also tried:

interface CalendarRootProps extends MultipleCalendarRootProps, SingleCalendarRootProps {
}

which will also work because it's an interface, but I think they are not functionally equivalent.

@zernonia
Copy link
Member

Thanks for the PR @RayGuo-ergou ! Can you share more details of the error you are having? It's weird that such error being thrown, as internally the component should be able to refer those types correctly.

@RayGuo-ergou
Copy link
Contributor Author

RayGuo-ergou commented May 13, 2024

It's only happening when the build reference and expose this type for my library.
e.g. I have the props type

// types.ts
export type MyProps = CalendarRootProps & {
  ...
}
// index.ts

export type * from './types'

or even just use in Calendar.vue, because the build will create a type declare file for each component, will also see this error.

I will create a reproduction repo later.

@RayGuo-ergou
Copy link
Contributor Author

RayGuo-ergou commented May 14, 2024

Hi @zernonia, here's a reproduction of this issue: https://github.com/RayGuo-ergou/radix-reproduction

It's actually caused by th vite-plugin-dts because that plugin is to generate type declare files.

@RayGuo-ergou
Copy link
Contributor Author

RayGuo-ergou commented May 14, 2024

image

After manually export the type:
image

Copy link
Member

@zernonia zernonia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reproduction and the images before/after the fix!
LGTM! 🚀

@zernonia zernonia merged commit e32d770 into unovue:main May 14, 2024
@RayGuo-ergou RayGuo-ergou deleted the hotfix/export_calendar_props branch May 14, 2024 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants