-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Description
Version
3.0.0-beta.2
Reproduction link
https://codesandbox.io/s/amazing-meitner-tgk24?file=/src/main.ts
Steps to reproduce
See main.ts
in repro.
I'm having typing issues with defineComponent
once more, it seems to me the root cause is that defineComponent
TS definition pretends to return a ctor when it does not.
This time the offender is Component
: a union type that includes both stateful and functional components but not ctor, which would be ok if defineComponent
wasn't lying about its return type.
Out of curiosity, I looked at how createApp
manages to do it: its first argument is a PublicApiComponent
, which turns out to be... the union of Component
and Ctor!
This is just confusing, not to mention PublicApiComponent
is not exported, so there's no type in Vue API that can be used to describe a "component" type that would work in all cases.
What is expected?
Code should compile? Or a good alternative be provided?
What is actually happening?
TS error as Ctor is not a Component.