Skip to content

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

Open
@ZadorozhnyiYevhenii

Description

@ZadorozhnyiYevhenii

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)

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