From 01fa45737088733d95d8df1a26d1467d6f82d2d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 12:56:21 -0500 Subject: [PATCH] chore(deps-dev): bump @types/react from 18.0.28 to 18.2.21 (#3674) * chore(deps-dev): bump @types/react from 18.0.28 to 18.2.21 Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.0.28 to 18.2.21. - [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-minor ... Signed-off-by: dependabot[bot] * chore: keep react 18 versions in sync with package.json * refactor(Dialog): narrow types inherited from ButtonProps for DialogButtonProps * refactor(MarkdownViewer): use toString() on TrustedHTML type * Update MarkdownViewer.tsx --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Josh Black Co-authored-by: Josh Black --- package-lock.json | 8 +++---- package.json | 2 +- script/set-react-version.js | 22 ++++++++++++++------ src/Dialog/Dialog.tsx | 2 +- src/drafts/MarkdownViewer/MarkdownViewer.tsx | 2 +- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3664fec56d6..2e383ff1c75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -89,7 +89,7 @@ "@types/lodash.isobject": "3.0.7", "@types/lodash.keyby": "4.6.7", "@types/node": "18.16.19", - "@types/react": "18.0.28", + "@types/react": "18.2.21", "@types/react-dom": "18.2.6", "@typescript-eslint/eslint-plugin": "5.59.6", "@typescript-eslint/parser": "5.62.0", @@ -12331,9 +12331,9 @@ "dev": true }, "node_modules/@types/react": { - "version": "18.0.28", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.28.tgz", - "integrity": "sha512-RD0ivG1kEztNBdoAK7lekI9M+azSnitIn85h4iOiaLjaTrMjzslhaqCGaI4IyCJ1RljWiLCEu4jyrLLgqxBTew==", + "version": "18.2.21", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.21.tgz", + "integrity": "sha512-neFKG/sBAwGxHgXiIxnbm3/AAVQ/cMRS93hvBpg8xYRbeQSPVABp9U2bRnPf0iI4+Ucdv3plSxKK+3CW2ENJxA==", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", diff --git a/package.json b/package.json index c1ad334314b..176022a0fbc 100644 --- a/package.json +++ b/package.json @@ -174,7 +174,7 @@ "@types/lodash.isobject": "3.0.7", "@types/lodash.keyby": "4.6.7", "@types/node": "18.16.19", - "@types/react": "18.0.28", + "@types/react": "18.2.21", "@types/react-dom": "18.2.6", "@typescript-eslint/eslint-plugin": "5.59.6", "@typescript-eslint/parser": "5.62.0", diff --git a/script/set-react-version.js b/script/set-react-version.js index 1f020333543..57855b0e8f6 100644 --- a/script/set-react-version.js +++ b/script/set-react-version.js @@ -3,6 +3,7 @@ const fs = require('node:fs/promises') const os = require('node:os') const path = require('node:path') +const packageJson = require('../package.json') const versions = new Map([ [ @@ -38,27 +39,27 @@ const versions = new Map([ devDependencies: [ { name: '@types/react', - version: '18.0.28', + version: getPackageVersion('@types/react'), }, { name: '@types/react-dom', - version: '18.2.6', + version: getPackageVersion('@types/react-dom'), }, { name: 'react', - version: '18.2.0', + version: getPackageVersion('react'), }, { name: 'react-dom', - version: '18.2.0', + version: getPackageVersion('react-dom'), }, { name: 'react-test-renderer', - version: '18.2.0', + version: getPackageVersion('react-test-renderer'), }, { name: '@testing-library/react', - version: '14.0.0', + version: getPackageVersion('@testing-library/react'), }, ], }, @@ -82,6 +83,15 @@ async function main(version = 17) { await fs.writeFile(packageJsonPath, contents) } +function getPackageVersion(name) { + const {devDependencies} = packageJson + if (devDependencies[name]) { + return devDependencies[name] + } + + throw new Error(`Unable to find version for package: ${name}`) +} + const [version] = process.argv.slice(2) // eslint-disable-next-line github/no-then diff --git a/src/Dialog/Dialog.tsx b/src/Dialog/Dialog.tsx index 6a6391384af..10a34974cab 100644 --- a/src/Dialog/Dialog.tsx +++ b/src/Dialog/Dialog.tsx @@ -20,7 +20,7 @@ const ANIMATION_DURATION = '200ms' * Props that characterize a button to be rendered into the footer of * a Dialog. */ -export type DialogButtonProps = ButtonProps & { +export type DialogButtonProps = Omit & { /** * The type of Button element to use */ diff --git a/src/drafts/MarkdownViewer/MarkdownViewer.tsx b/src/drafts/MarkdownViewer/MarkdownViewer.tsx index f34f08e25dc..33f5acc4d4d 100644 --- a/src/drafts/MarkdownViewer/MarkdownViewer.tsx +++ b/src/drafts/MarkdownViewer/MarkdownViewer.tsx @@ -78,7 +78,7 @@ const MarkdownViewer = ({ await externalOnChange?.(value) } catch (error) { if (htmlContainer) { - htmlContainer.innerHTML = dangerousRenderedHTML.__html + htmlContainer.innerHTML = dangerousRenderedHTML.__html as string } } },