Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable TypeScript Support for Partial Updates in patchOptions from useModal #461

Open
ZadorozhnyiYevhenii opened this issue Jan 17, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ZadorozhnyiYevhenii
Copy link

ZadorozhnyiYevhenii commented Jan 17, 2025

Version

vue-final-modal: 4.5.5
vue: 3.5.13
nuxt: 3.15.1

OS

Mac

What is Expected?

When using patchOptions, which is returned from useModal, I would like to enable TypeScript support for partial patching of options. Currently, if a modal has two props (regardless of whether they are required or optional), calling patchOptions({ attrs: { prop1: true } }) results in a TypeScript error indicating that the second prop is not set. However, since patchOptions is designed to allow partial updates to options, it should support partial typing without requiring all props to be defined.

What is actually happening?

Type '{ prop1: boolean; }' is not assignable to type 'NonNullable<Partial<{}> & Omit<{ readonly prop1: boolean; readonly prop2: boolean; } & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>>'.
  Property 'prop1' is missing in type '{ prop2: boolean; }' but required in type 'Omit<{ readonly prop1: boolean; readonly prop2: boolean; } & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>'.ts-plugin(2322)
@ZadorozhnyiYevhenii
Copy link
Author

PR with fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants