From fe394f49753faf11550af00568d7687ab9b931d9 Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Tue, 24 Jan 2023 13:48:55 -0800 Subject: [PATCH 1/2] Fix EuiModalHeaderTitle throwing type errors on EuiTitle props - these are currently technically already accepted via `...rest`, but Typescript is doin the red squiggly --- .../modal/__snapshots__/modal_header_title.test.tsx.snap | 8 ++++++++ src/components/modal/modal_header_title.test.tsx | 9 +++++++++ src/components/modal/modal_header_title.tsx | 7 +++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/components/modal/__snapshots__/modal_header_title.test.tsx.snap b/src/components/modal/__snapshots__/modal_header_title.test.tsx.snap index eabac1765d15..9e14e8b928a5 100644 --- a/src/components/modal/__snapshots__/modal_header_title.test.tsx.snap +++ b/src/components/modal/__snapshots__/modal_header_title.test.tsx.snap @@ -1,5 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`EuiModalHeaderTitle allows passing any props that EuiTitle accepts 1`] = ` +

+ children +

+`; + exports[`EuiModalHeaderTitle component 1`] = `
{ ); expect(container.firstChild).toMatchSnapshot(); }); + + it('allows passing any props that EuiTitle accepts', () => { + const { container } = render( + + children + + ); + expect(container.firstChild).toMatchSnapshot(); + }); }); diff --git a/src/components/modal/modal_header_title.tsx b/src/components/modal/modal_header_title.tsx index 809c9caae643..2ea2cb70970f 100644 --- a/src/components/modal/modal_header_title.tsx +++ b/src/components/modal/modal_header_title.tsx @@ -8,13 +8,12 @@ import React, { FunctionComponent, HTMLAttributes, ElementType } from 'react'; import classnames from 'classnames'; -import { CommonProps } from '../common'; -import { EuiTitle } from '../title'; +import { EuiTitle, EuiTitleProps } from '../title'; export type EuiModalHeaderTitleProps = FunctionComponent< - HTMLAttributes & - CommonProps & { + Omit & + HTMLAttributes & { /** * The tag to render. Can be changed to a lower heading * level like `h2` or a container `div`. From fd6b2e7b2ae7fa2656575b7013673ebf047f58d4 Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Tue, 24 Jan 2023 13:57:42 -0800 Subject: [PATCH 2/2] changelog --- upcoming_changelogs/6547.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 upcoming_changelogs/6547.md diff --git a/upcoming_changelogs/6547.md b/upcoming_changelogs/6547.md new file mode 100644 index 000000000000..a672552db01d --- /dev/null +++ b/upcoming_changelogs/6547.md @@ -0,0 +1,3 @@ +**Bug fixes** + +- Fixed `EuiModalHeaderTitle` type errors when passed `EuiTitle` props