Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] missing prop value for onChange-Event (RadioGroup + FormControlLabel) #13004

Closed
2 tasks done
PutziSan opened this issue Sep 25, 2018 · 1 comment
Closed
2 tasks done

Comments

@PutziSan
Copy link

TypeScript shows an error when implement the Radio Buttons-example from the docs: Property 'value' does not exist on type 'EventTarget'. or Type '(event: ChangeEvent<HTMLInputElement>, value: string) => void' is not assignable to type '(event: ChangeEvent<{}>, value: string) => void'

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

The handleChange-event for RadioGroup and FormControlLabel should include the HTMLInputElement-type: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void; and (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;

Current Behavior

Currently it is implemented via event: React.ChangeEvent<{}>, which does not include a value-prop.

Steps to Reproduce

Link: sandbox (see onChange of the <RadioGroup>)

It is implemented with an arrow function, since Sandbox displays the error here, but the implementation with a class function also results in an error (codesandbox swallows this error):

image

Context

Your Environment

Tech Version
Material-UI v3.1.1
React 16.5.2
TypeScript 3.0.3

(By the way, you could change the issue-template, currently "v1.?.?" is prefilled, but "v3.?.?" would make more sense I think? ;-) )

@eps1lon
Copy link
Member

eps1lon commented Jun 13, 2019

A TypeScript demo was introduced in #15408 and is available under https://material-ui.com/components/radio-buttons/#RadioButtonsGroup.tsx.

@eps1lon eps1lon closed this as completed Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants