Skip to content

error using type union or intersection in defineProps #8194

@nip10

Description

@nip10

Vue version

3.2.47

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-1fkknn

Steps to reproduce

  1. Create a type union/intersection
  2. Use the type union/intersection in defineProps

What is expected?

defineProps allows type union/intersection

What is actually happening?

defineProps doesnt allow type union/intersection

[vite] Internal server error: [@vue/compiler-sfc] type argument passed to defineProps() must be a literal type, or a reference to an interface or literal type.

/home/projects/vitejs-vite-1fkknn/src/components/HelloWorld.vue
12 |  type HelloWorldProps = BaseProps & OtherProps;
13 |  
14 |  withDefaults(defineProps<HelloWorldProps>(), {
   |                           ^^^^^^^^^^^^^^^
15 |    msg: 'Hello World',
16 |  });

System Info

No response

Any additional comments?

No response

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