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

Upgrade typescript, react, jest, & enzyme #1583

Merged
merged 16 commits into from
Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/dtsgenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ const generator = dtsGenerator({
},
});

// NOTE: once EUI is all converted to typescript this madness can be deleted for ever
// NOTE: once EUI is all converted to typescript this madness can be deleted forever
// 1. strip any `/// <reference` lines from the generated eui.d.ts
// 2. replace any import("src/...") declarations to import("@elastic/src/...")
// 3. replace any import("./...") declarations to import("@elastic/src/...)
// 2. replace any import("src/...") declarations to import("@elastic/eui/src/...")
// 3. replace any import("./...") declarations to import("@elastic/eui/src/...)
generator.then(() => {
const defsFilePath = path.resolve(baseDir, 'eui.d.ts');

Expand Down
56 changes: 53 additions & 3 deletions src/components/button/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CommonProps } from '../common';
import { IconType, IconSize } from '../icon'
import { ToggleType } from '../toggle'

import { FunctionComponent, ButtonHTMLAttributes, AnchorHTMLAttributes, MouseEventHandler, HTMLAttributes } from 'react';
import { FunctionComponent, ButtonHTMLAttributes, AnchorHTMLAttributes, ChangeEventHandler, MouseEventHandler, HTMLAttributes } from 'react';

declare module '@elastic/eui' {
type EuiButtonPropsForButtonOrLink<Props> = (
Expand Down Expand Up @@ -95,7 +95,57 @@ declare module '@elastic/eui' {
textProps?: HTMLAttributes<HTMLSpanElement>;
}>

export const EuiButtonEmpty: FunctionComponent<
EuiButtonPropsForButtonOrLink<CommonProps & EuiButtonEmptyProps>
export const EuiButtonEmpty: FunctionComponent<EuiButtonEmptyProps>;

/**
* button toggle type defs
*
* @see './button_toggle/button_toggle.js'
*/

export type EuiButtonToggleProps = EuiButtonProps & {
isEmpty?: boolean;
isIconOnly?: boolean;
isSelected?: boolean;
label: string;
toggleClassName?: string;
type?: ToggleType;
}

export const EuiButtonToggle: FunctionComponent<
EuiButtonPropsForButtonOrLink<CommonProps & EuiButtonToggleProps>
>;

/**
* button group type defs
*
* @see './button_group/button_group.js'
*/

export type EuiButtonGroupIdToSelectedMap = { [id: string]: boolean };
export type GroupButtonSize = 's' | 'm';

export interface EuiButtonGroupOption {
id: string,
label: string,
isDisabled?: boolean,
}
export interface EuiButtonGroupProps {
options: EuiButtonGroupOption[],
onChange: (id: string, value: any) => void;
buttonSize?: GroupButtonSize;
isDisabled?: boolean,
isFullWidth?: boolean;
isIconOnly?: boolean;
idSelected?: string;
idToSelectedMap?: EuiButtonGroupIdToSelectedMap;
legend?: string,
color?: ButtonColor,
type?: ToggleType,
name?: string;
}

export const EuiButtonGroup: FunctionComponent<
HTMLAttributes<HTMLDivElement> & EuiButtonGroupProps
>;
}
1 change: 0 additions & 1 deletion src/components/modal/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { CommonProps, Omit } from '../common';
/// <reference path="../button/index.d.ts" />
/// <reference path="../focus_trap/index.d.ts" />

import { FocusTarget } from 'focus-trap';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this

import { ReactNode, FunctionComponent, HTMLAttributes } from 'react';

declare module '@elastic/eui' {
Expand Down
1 change: 0 additions & 1 deletion src/components/popover/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { CommonProps, NoArgCallback } from '../common';
/// <reference path="../focus_trap/index.d.ts" />
/// <reference path="../panel/index.d.ts" />

import { FocusTarget } from 'focus-trap';
import { FunctionComponent, ReactNode, HTMLAttributes } from 'react';

declare module '@elastic/eui' {
Expand Down