Skip to content

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

Description

@rembrandtreyes

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;?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions