From 0d181683e841d817a18475a056c0707bd12d9318 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Feb 2022 00:53:49 +0000 Subject: [PATCH 1/3] chore(deps-dev): bump @types/react from 16.14.18 to 17.0.39 Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 16.14.18 to 17.0.39. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- updated-dependencies: - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 354559cc6a..b6aa763360 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6062,9 +6062,9 @@ "@types/react" "*" "@types/react@*", "@types/react@>=16.9.0", "@types/react@^16.13.1 || ^17.0.0": - version "16.14.18" - resolved "https://registry.npmjs.org/@types/react/-/react-16.14.18.tgz#b2bcea05ee244fde92d409f91bd888ca8e54b20f" - integrity sha512-eeyqd1mqoG43mI0TvNKy9QNf1Tjz3DEOsRP3rlPo35OeMIt05I+v9RR8ZvL2GuYZeF2WAcLXJZMzu6zdz3VbtQ== + version "17.0.39" + resolved "https://registry.npmjs.org/@types/react/-/react-17.0.39.tgz#d0f4cde092502a6db00a1cded6e6bf2abb7633ce" + integrity sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" From 9643f75a1197e02efaa24d755dc058c46f6bd007 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 9 Feb 2022 14:29:47 +0100 Subject: [PATCH 2/3] chore: added guards as these could be string types which don't have props... Signed-off-by: blam --- .../core-components/src/layout/TabbedCard/TabbedCard.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core-components/src/layout/TabbedCard/TabbedCard.tsx b/packages/core-components/src/layout/TabbedCard/TabbedCard.tsx index 06e9f53224..b3b977f04b 100644 --- a/packages/core-components/src/layout/TabbedCard/TabbedCard.tsx +++ b/packages/core-components/src/layout/TabbedCard/TabbedCard.tsx @@ -89,12 +89,15 @@ export function TabbedCard(props: PropsWithChildren) { let selectedTabContent: ReactNode; if (!value) { React.Children.map(children, (child, index) => { - if (index === selectedIndex) selectedTabContent = child?.props.children; + if (React.isValidElement(child) && index === selectedIndex) { + selectedTabContent = child?.props.children; + } }); } else { React.Children.map(children, child => { - if (child?.props.value === value) + if (React.isValidElement(child) && child?.props.value === value) { selectedTabContent = child?.props.children; + } }); } From 89c84b9108e0e46ee8426271f800ad9e26d050d2 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 9 Feb 2022 14:31:24 +0100 Subject: [PATCH 3/3] chore: added changeset for r17 issues Signed-off-by: blam --- .changeset/tall-elephants-smash.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tall-elephants-smash.md diff --git a/.changeset/tall-elephants-smash.md b/.changeset/tall-elephants-smash.md new file mode 100644 index 0000000000..a26dbd65a6 --- /dev/null +++ b/.changeset/tall-elephants-smash.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-components': patch +--- + +chore: fixing typescript errors for `TabbedCard.tsx` for React 17.x