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

Preparation for upgrading EUI so that it includes date picker types #31801

Closed

Conversation

jasonrhodes
Copy link
Member

@jasonrhodes jasonrhodes commented Feb 22, 2019

UPDATE: This PR replaced by #32009

Summary

PR for fixing bugs related to introducing types for EUI Date Picker components. For now, you can yarn link the EUI repo locally with this branch checked out: elastic/eui#1574

There are lots of type failures happening right now related to Date vs Moment types. Including a sample of those here:

ERROR x-pack failed

      plugins/infra/public/components/logging/log_time_controls.tsx:62:15 - error TS2322: Type '(date: Moment | null) => void' is not assignable to type '(date: Date | null, event: SyntheticEvent<any> | undefined) => void'.
        Types of parameters 'date' and 'date' are incompatible.
          Type 'Date | null' is not assignable to type 'Moment | null'.
            Type 'Date' is not assignable to type 'Moment'.

      62               onChange={this.handleChangeDate}
                       ~~~~~~~~

        ../../eui/node_modules/@types/react-datepicker/index.d.ts:68:2
          68  onChange(date: Date | null, event: React.SyntheticEvent<any> | undefined): void;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          The expected type comes from property 'onChange' which is declared here on type 'IntrinsicAttributes & CommonProps & EuiExtendedDatePickerProps & { children?: ReactNode; }'



      plugins/infra/public/components/logging/log_time_controls.tsx:64:15 - error TS2322: Type 'Moment | null' is not assignable to type 'Date | null | undefined'.
        Type 'Moment' is not assignable to type 'Date'.

      64               selected={currentMoment}
                       ~~~~~~~~

        ../../eui/node_modules/@types/react-datepicker/index.d.ts:104:2
          104  selected?: Date | null;
               ~~~~~~~~
          The expected type comes from property 'selected' which is declared here on type 'IntrinsicAttributes & CommonProps & EuiExtendedDatePickerProps & { children?: ReactNode; }'



      plugins/infra/public/components/logging/log_time_controls.tsx:68:15 - error TS2322: Type 'Moment[]' is not assignable to type 'Date[]'.

      68               injectTimes={currentMoment ? [currentMoment] : []}
                       ~~~~~~~~~~~

        ../../eui/node_modules/@types/react-datepicker/index.d.ts:56:2
          56  injectTimes?: Date[];
              ~~~~~~~~~~~
          The expected type comes from property 'injectTimes' which is declared here on type 'IntrinsicAttributes & CommonProps & EuiExtendedDatePickerProps & { children?: ReactNode; }'



      plugins/infra/public/components/range_date_picker/index.tsx:279:13 - error TS2322: Type 'Element' is not assignable to type 'StatelessComponent<EuiDatePickerProps>'.
        Type 'Element' provides no match for the signature '(props: CommonProps & EuiExtendedDatePickerProps & { children?: ReactNode; }, context?: any): ReactElement<any> | null'.

      279             startDateControl={
                      ~~~~~~~~~~~~~~~~

        ../../eui/eui.d.ts:2978:6
          2978      startDateControl: typeof EuiDatePicker;
                    ~~~~~~~~~~~~~~~~
          The expected type comes from property 'startDateControl' which is declared here on type 'IntrinsicAttributes & CommonProps & { startDateControl: StatelessComponent<EuiDatePickerProps>; endDateControl: StatelessComponent<EuiDatePickerProps>; iconType?: boolean | ... 291 more ... | undefined; fullWidth?: boolean | undefined; isCustom?: boolean | undefined; } & { ...; }'

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@jasonrhodes jasonrhodes changed the title Fixed a simple argument bug and removed infra date picker EUI types Preparation for upgrading EUI so that it includes date picker types Feb 22, 2019
@jasonrhodes jasonrhodes deleted the upgrade-eui-datepicker-types branch February 26, 2019 13:04
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 this pull request may close these issues.

2 participants