Skip to content

Type of 'onClick' regression #7016

@ShimiSun

Description

@ShimiSun

Originally posted by @ShimiSun in #6983 (comment)

Our team is experiencing a backward compatibility issue due to this fix. This PR is limiting the range of mouse event type and we are seeing the following type error:

 Type '((event: MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined' is not assignable to type 
 '((event: MouseEvent<Element, MouseEvent>) => void) | undefined'.

Hence, until now, grommet accepted HTMLDivElement, but now it only allows Element. I suspect this may not be backward compatible. https://developer.mozilla.org/en-US/docs/Web/API/HTMLDivElement

Here are a couple (out of 8) of workarounds we had to apply in order to get the new typing to work
image

Unfortunately, this is reducing our type-specific and making our code less safe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    typescriptTypescript enhancements and bugs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions