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

currentView missing from DatetimepickerState in TS typings/DateTime.d.ts #826

Open
rembrandtreyes opened this issue Apr 8, 2022 · 0 comments · May be fixed by #862
Open

currentView missing from DatetimepickerState in TS typings/DateTime.d.ts #826

rembrandtreyes opened this issue Apr 8, 2022 · 0 comments · May be fixed by #862

Comments

@rembrandtreyes
Copy link

I'm Submitting a ...

[x] Bug report
[ ] Feature request
[ ] Support request

I am currently using the TypeScript types from the Datetime component and noticed when I try to access the state.currentView I get this TS error Argument of type '{ currentView: string; }' is not assignable to parameter of type 'DatetimepickerState | ((prevState: Readonly<DatetimepickerState>, props: Readonly<DatetimepickerProps>) => DatetimepickerState | ... 1 more ... | null) | Pick<...> | null'.

Looking at the code looks like you have

this.state = {
  open: !props.input,
  currentView: props.initialViewMode || this.getInitialView(),
  viewDate: this.getInitialViewDate(selectedDate),
  selectedDate:
    selectedDate && selectedDate.isValid() ? selectedDate : undefined,
  inputValue: this.getInitialInputValue(selectedDate),
};

And in DateTime.d.ts you have

export interface DatetimepickerState {
  updateOn: string;
  inputFormat: string;
  viewDate: Moment;
  selectedDate: Moment;
  inputValue: string;
  open: boolean;
}

Shouldn't DatetimepickerState include currentView: ViewMode in the interface and it seems like you can remove updateOn: string;?

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

Successfully merging a pull request may close this issue.

1 participant