mantine icon indicating copy to clipboard operation
mantine copied to clipboard

typesafe context modals - MantineModalsOverride doesnt work

Open mpsenicka opened this issue 2 years ago • 1 comments

What package has an issue

@mantine/modals

Describe the bug

I am trying to let typescript hint me names of context modals, as listed in this chapter.

By providing modals override through MantineModalsOverride interface, i successfully extend modals by "testOverride", as shown in picture below: image

But even though i extend it, MantineModal type still extracts only "string" value, as shown here: image

I think wanted behaviour is as follows: image

Do you have an idea on how to solve this? Or am i doing something wrong?

What version of @mantine/hooks page do you have in package.json?

6.0.10

If possible, please include a link to a codesandbox with the reproduced problem

https://codesandbox.io/s/musing-lehmann-wbj8lp?file=/src/App.tsx

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

Yes

Possible fix

Don't check whether overrides structure has modals property, just let user override it as he would like. Typically if someone changes d.ts files, he usually knows what he's doing

mpsenicka avatar Jun 01 '23 07:06 mpsenicka

PR: https://github.com/mantinedev/mantine/pull/4343

mpsenicka avatar Jun 01 '23 08:06 mpsenicka

Fixed in #6443

rtivital avatar Jul 02 '24 11:07 rtivital