I'm trying to use React with TypeScript and Material-UI's components. Unfortunately, I'm getting the errors like this:
Property 'openToYearSelection' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> ...'.
import * as React from 'react';
import DatePicker from 'material-ui/DatePicker';
interface IState {
birthday: any,
}
export default class SampleForm extends React.Component<IProps, IState> {
constructor(props: any) {
super(props);
const { record = {} } = this.props;
this.state = {
birthday: record.birthday || null,
};
}
public birthdayPicker() {
const { birthday } = this.state;
return (
<DatePicker
defaultDate={birthday}
hintText="Birthday"
openToYearSelection={true}
/>
);
}
public render() {
return (
<form style={styles.root}>
{this.header()}
{this.firstName()}
{this.lastName()}
{this.birthdayPicker()}
{this.phoneNumber()}
{this.actionButtons()}
</form>
)
}
}
What's the right way to use Material-UI with TypeScript and React?
@types/material-ui
package? And is your material-ui version on a 0.x version or on v1-beta? – CRice// @ts-expect-error
above the line that is erroring – Caleb Lawrence