Open IlyaSemenov opened 3 weeks ago
Oh yeah right! I've encountered the any
type too, but I couldn't find the reason why this happens.
Even though I would like to stay with zero dependencies, I will consider adding the dependency or rewiring these parts.
Thanks alot!
I suppose you could just borrow it from there, it's not a big deal really:
export type ComponentProps<T> =
T extends new (...angs: any) => { $props: infer P; } ? NonNullable<P> :
T extends (props: infer P, ...args: any) => any ? P :
{};
Also, just a heads up, in tsup
one can mark certain external packages to be bundled (inlined) with noExternal
option: https://tsup.egoist.dev/#excluding-packages. This way, the type will be inlined automatically on .d.ts
build.
I'm not sure what's the counterpart in raw vite/rollup/babel setup that you use in Oruga, but there could be one as well (after all, tsup uses rollup under the hood).
Overview of the problem
Oruga version: 0.9.0-pre.1 Vuejs version: 3.4.37
Description
vue-component-type-helpers
is naturally a direct dependency of oruga, e.g.:https://github.com/oruga-ui/oruga/blob/67f7ac7d51ba3009f3142efb7aeecc95681fc503/packages/oruga/src/components/modal/types.ts#L1
however, it's not listed in
package.json
as a dependency (only as a dev dependency), and is thus not installed to user'snode_modules
when they install oruga.As such, all dependent types, such as
ModalProgrammaticProps
, resolve toany
:Steps to reproduce
"@oruga-ui/oruga-next": "0.9.0-pre.1"
in empty project.node_modules/@oruga-ui/oruga-next/dist/types/components/modal/ModalProgrammatic.d.ts
ModalProgrammaticProps
resolves.Expected behavior
vue-component-type-helpers
should be a direct dependency oforuga-next
, it should be installed in user'snode_modules
, and thenModalProgrammaticProps
should resolve to the proper type.Actual behavior
vue-component-type-helpers
is not installed in user'snode_modules
, andModalProgrammaticProps
(and other similar types) resolve toany
as Typescript's fallback measure.