Skip to content

TS: defineComponent returns incorrect type #730

Closed
@jods4

Description

@jods4

Version

3.0.0-alpha.4

Reproduction link

https://codesandbox.io/s/boring-cerf-fkv0z

Steps to reproduce

In Typescript, use defineComponent to create a component, then try to use it with .component('x-tag', MyComponent).

What is expected?

TS should compile (it does run).

What is actually happening?

There is a type error at compilation.


The problem seems to be that defineComponent is lying about its return type. It says that it returns a constructor, which is not true since it is mostly a noop (it returns its parameter directly, which is an object).

createApp accepts this because it seems to accept constructors in addition to components. But .component() does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions