diff --git a/CHANGELOG.md b/CHANGELOG.md index 3af4b5e63ae..1db02dc9724 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ **Bug fixes** - Set `EuiFlexGroup` to `flex-grow: 1` to be more friendly with IE11 [(#315)](https://github.com/elastic/eui/pull/315) +- Fix TypeScript definitions such that optional and readonly properties survive being passed through `Omit` [(#322)](https://github.com/elastic/eui/pull/322) # [`0.0.13`](https://github.com/elastic/eui/tree/v0.0.13) diff --git a/src/components/common.d.ts b/src/components/common.d.ts index b33923198f3..421701062ec 100644 --- a/src/components/common.d.ts +++ b/src/components/common.d.ts @@ -18,5 +18,5 @@ declare module '@elastic/eui' { type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; - type Omit = { [P in Diff]: T[P] }; + type Omit = Pick>; } diff --git a/src/components/context_menu/index.d.ts b/src/components/context_menu/index.d.ts index bde99cac903..c1d716701c2 100644 --- a/src/components/context_menu/index.d.ts +++ b/src/components/context_menu/index.d.ts @@ -90,13 +90,11 @@ declare module '@elastic/eui' { content?: React.ReactNode; } - export interface EuiContextMenuProps { - panels?: EuiContextMenuPanelDescriptor[]; - initialPanelId?: EuiContextMenuPanelId; - } + export type EuiContextMenuProps = CommonProps & + Omit, 'style'> & { + panels?: EuiContextMenuPanelDescriptor[]; + initialPanelId?: EuiContextMenuPanelId; + }; - export const EuiContextMenu: SFC< - Omit, 'className' | 'style'> & - EuiContextMenuProps - >; + export const EuiContextMenu: SFC; }