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

Allow partial props for muiFieldProps in SQFormDatePickerWithDateFNS #880

Open
Ariel-Schnur-SQ opened this issue Apr 13, 2023 · 0 comments

Comments

@Ariel-Schnur-SQ
Copy link

TS is yelling at me for excluding some muiFieldProps in my SQFormDatePickerWithDateFNS. Is it possible to update the type for muiFieldProps to allow partial props?

My usage:

<SQFormDatePickerWithDateFNS
      name={question.id}
      label={labelText || ''}
      onBlur={onBlur}
      muiFieldProps={{
        onAccept: onDateAccept,
        minDate: question.minValue ? new Date(question.minValue) : undefined,
        maxDate: question.maxValue ? new Date(question.maxValue) : undefined,
      }}
      isDisabled={isDisabled}
      size={4}
/>

TS error TLDR (I think): you need onChange, value, and renderInput in muiFieldProps!

Full TS error:

Type '{ onAccept: ((value: Date | null) => void) | undefined; minDate: Date | undefined; maxDate: Date | undefined; }' is not assignable to type 'MuiFieldProps<Date>'.
  Type '{ onAccept: ((value: Date | null) => void) | undefined; minDate: Date | undefined; maxDate: Date | undefined; }' is missing the following properties from type 'BaseDatePickerProps<Date, Date>': onChange, value, renderInputts(2322)
SQFormDatePickerWithDateFNS.d.ts(8, 5): The expected type comes from property 'muiFieldProps' which is declared here on type 'IntrinsicAttributes & Omit<SQFormDatePickerProps, "onChange" | "muiFieldProps"> & { onChange?: ((date: Date | null) => void) | undefined; muiFieldProps?: MuiFieldProps<Date> | undefined; }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant