Skip to content

useModal().create typing doesn't allow custom props for custom components #2919

@gtbuchanan

Description

@gtbuchanan

Describe the bug

Given a custom modal component named MyModal that has a prop myProp, the following results in a type error:

const { create } = useModal();
await using modal = create({
  component: MyModal,
  myProp: 'My Value', // Triggers TS 2353
});
await modal.show();

Object literal may only specify known properties, and 'myProp' does not exist in type 'ModalOrchestratorCreateParam'.

The binding still works, but I have to add a ts-expect-error suppression to circumvent type checks.

In the reproduction, you can press Ctrl+C in the terminal and run npm run build to display the error.

Reproduction

https://stackblitz.com/edit/github-yoeea7v5?file=src%2FApp.vue

Used Package Manager

pnpm

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions