Skip to content

[Bug]: react-radio typings for onChange does not allow data argument #22752

@miroslavstastny

Description

@miroslavstastny

Library

React Components / v9 (@fluentui/react-components)

System Info

-

Are you reporting Accessibility issue?

no

Reproduction

Bug Description

Actual Behavior

RadioProps types onChange as it has two arguments:

  onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: RadioOnChangeData) => void;

As the RadioProps is intersection of ComponentProps<..., 'input'> it does not allow the data argument:


TS2322: Type '(e: ChangeEvent<HTMLInputElement>, d: RadioOnChangeData) => void' is not assignable to type 'ChangeEventHandler<HTMLInputElement> & ((ev: ChangeEvent<HTMLInputElement>, data: RadioOnChangeData) => void)'.   Type '(e: ChangeEvent<HTMLInputElement>, d: RadioOnChangeData) => void' is not assignable to type 'ChangeEventHandler<HTMLInputElement>'.  index.d.ts(2217, 9): The expected type comes from property 'onChange' which is declared here on type 'IntrinsicAttributes & Omit<ComponentProps<Partial<RadioSlots>, "input">, "size"> & { value?: string | undefined; labelPosition?: "after" | ... 1 more ... | undefined; disabled?: boolean | undefined; onChange?: ((ev: ChangeEvent<...>, data: RadioOnChangeData) => void) | undefined; } & RefAttributes<...>'

Expected Behavior

data argument is valid on onChange

Logs

No response

Requested priority

Normal

Products/sites affected

No response

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions