setState has problem
Hi I got this:
Error - typescript - src/webparts/annualLeaveForm/components/AnnualLeaveForm.tsx(242,22): error TS2345: Argument of type '{ leaveType: any; }' is not assignable to parameter of type '{ leaveType: any; vacationRequest: any; }'.
export default class AnnualLeaveForm extends React.Component<IAnnualLeaveFormProps, { leaveType: any, vacationRequest: any }> {
this.setState({ vacationRequest: value[item] });
If i have two variables in state, i can't set only one? i am using node v8.11.4.
thanks Peter
Has nothing to do with the Node version, we think you need to use the setState as official docus
in windows, compile is ok, but in mac fail. I solved it by adding ? after variable name. Now it can be compile in both windows and mac. thanks
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues