mantine icon indicating copy to clipboard operation
mantine copied to clipboard

Error on useResizeObserver and Group

Open israelins85 opened this issue 1 year ago • 1 comments

Dependencies check up

  • [X] I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

7.5.3

What package has an issue?

@mantine/core

What framework do you use?

Next.js

In which browsers you can reproduce the issue?

None

Describe the bug

Type 'MutableRefObject<HTMLDivElement | undefined>' is not assignable to type 'Ref<HTMLDivElement> | undefined'. Type 'MutableRefObject<HTMLDivElement | undefined>' is not assignable to type 'RefObject<HTMLDivElement>'. Types of property 'current' are incompatible. Type 'HTMLDivElement | undefined' is not assignable to type 'HTMLDivElement | null'. Type 'undefined' is not assignable to type 'HTMLDivElement | null'.typescript(2322)

If possible, include a link to a codesandbox with a minimal reproduction

https://codesandbox.io/p/sandbox/mantine-group-ref-error-kvx58y

Possible fix

No response

Self-service

  • [ ] I would be willing to implement a fix for this issue

israelins85 avatar Feb 16 '24 17:02 israelins85

Is wrong use only: const [refRightSection, rectRightSection] = useResizeObserver<HTMLDivElement>();

?

israelins85 avatar Feb 16 '24 17:02 israelins85

I'm having a similar issue, looks to be caused by the fix to https://github.com/mantinedev/mantine/issues/5752

pauledwards241 avatar Feb 21 '24 11:02 pauledwards241

Fixed in 7.6.1

rtivital avatar Feb 27 '24 07:02 rtivital

@rtivital I'm a little confused by this fix. Why are we now returning any?

error  Unsafe array destructuring of a tuple element with an `any` value  @typescript-eslint/no-unsafe-assignment
ui:lint:   
error  Unsafe member access .current on an `any` value                    @typescript-eslint/no-unsafe-member-access

tobeycodes avatar Feb 27 '24 19:02 tobeycodes

Same here: https://github.com/mantinedev/mantine/commit/ec4fcf77d83a63ef050547e82d69bd3a03e1ef34#commitcomment-139346444

Unsafe assignment of an `any` value.eslint[@typescript-eslint/no-unsafe-assignment](https://typescript-eslint.io/rules/no-unsafe-assignment)

kenzaflow avatar Mar 04 '24 16:03 kenzaflow