From 60536ff6c1bbf60c338656e888e409e22ffc4ffa Mon Sep 17 00:00:00 2001 From: margolisj Date: Fri, 8 Sep 2023 17:16:30 -0400 Subject: [PATCH 1/4] Converts file to tsx, removes ts-no-check and small spelling fix --- .../src/toolbar/toolbar-dropdown-menu/{index.js => index.tsx} | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) rename packages/components/src/toolbar/toolbar-dropdown-menu/{index.js => index.tsx} (90%) diff --git a/packages/components/src/toolbar/toolbar-dropdown-menu/index.js b/packages/components/src/toolbar/toolbar-dropdown-menu/index.tsx similarity index 90% rename from packages/components/src/toolbar/toolbar-dropdown-menu/index.js rename to packages/components/src/toolbar/toolbar-dropdown-menu/index.tsx index 5a99fe00a6d50..283ae0bc31e7d 100644 --- a/packages/components/src/toolbar/toolbar-dropdown-menu/index.js +++ b/packages/components/src/toolbar/toolbar-dropdown-menu/index.tsx @@ -1,5 +1,3 @@ -// @ts-nocheck - /** * WordPress dependencies */ @@ -19,7 +17,7 @@ function ToolbarDropdownMenu( props, ref ) { return ; } - // ToobarItem will pass all props to the render prop child, which will pass + // ToolbarItem will pass all props to the render prop child, which will pass // all props to the toggle of DropdownMenu. This means that ToolbarDropdownMenu // has the same API as DropdownMenu. return ( From 872ddd7532bb03f44813b47a8905f52c51a099d0 Mon Sep 17 00:00:00 2001 From: margolisj Date: Fri, 8 Sep 2023 17:16:50 -0400 Subject: [PATCH 2/4] Spelling --- packages/components/src/ui/context/wordpress-component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/ui/context/wordpress-component.ts b/packages/components/src/ui/context/wordpress-component.ts index 3fc499900153b..bf70924b40bbb 100644 --- a/packages/components/src/ui/context/wordpress-component.ts +++ b/packages/components/src/ui/context/wordpress-component.ts @@ -14,7 +14,7 @@ export type WordPressComponentProps< > = P & // The `children` prop is being explicitly omitted since it is otherwise implicitly added // by `ComponentPropsWithRef`. The context is that components should require the `children` - // prop explicitely when needed (see https://github.com/WordPress/gutenberg/pull/31817). + // prop explicitly when needed (see https://github.com/WordPress/gutenberg/pull/31817). Omit< React.ComponentPropsWithoutRef< T >, 'as' | keyof P | 'children' > & ( IsPolymorphic extends true ? { From 2bf91fb8a276ecca0d41bfd9d4f80efc85ac3f37 Mon Sep 17 00:00:00 2001 From: margolisj Date: Fri, 8 Sep 2023 17:22:28 -0400 Subject: [PATCH 3/4] Adds dropdown menu types to toolbar dropdown --- .../src/toolbar/toolbar-dropdown-menu/index.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/components/src/toolbar/toolbar-dropdown-menu/index.tsx b/packages/components/src/toolbar/toolbar-dropdown-menu/index.tsx index 283ae0bc31e7d..6dc5fd523ec2f 100644 --- a/packages/components/src/toolbar/toolbar-dropdown-menu/index.tsx +++ b/packages/components/src/toolbar/toolbar-dropdown-menu/index.tsx @@ -3,14 +3,23 @@ */ import { forwardRef, useContext } from '@wordpress/element'; +/** + * External dependencies + */ +import type { ForwardedRef } from 'react'; + /** * Internal dependencies */ import ToolbarItem from '../toolbar-item'; import ToolbarContext from '../toolbar-context'; import DropdownMenu from '../../dropdown-menu'; +import type { DropdownMenuProps } from '../../dropdown-menu/types'; -function ToolbarDropdownMenu( props, ref ) { +function ToolbarDropdownMenu( + props: DropdownMenuProps, + ref: ForwardedRef< any > +) { const accessibleToolbarState = useContext( ToolbarContext ); if ( ! accessibleToolbarState ) { From 1e20243ce135662ce9104201f9dfe1a8675129f3 Mon Sep 17 00:00:00 2001 From: margolisj Date: Sat, 9 Sep 2023 12:18:39 -0400 Subject: [PATCH 4/4] Adds changelog entry --- packages/components/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index ca2d278909aa7..5bd55d90c3692 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -25,6 +25,7 @@ - `BorderControl`: Refactor unit tests to use `userEvent` ([#54155](https://github.com/WordPress/gutenberg/pull/54155)) - `FocusableIframe`: Convert to TypeScript ([#53979](https://github.com/WordPress/gutenberg/pull/53979)). - `Popover`: Remove unused `overlay` type from `positionToPlacement` utility function ([#54101](https://github.com/WordPress/gutenberg/pull/54101)). +- `Toolbar/ToolbarDropdownMenu `: Convert to TypeScript ([#54321](https://github.com/WordPress/gutenberg/pull/54321)). ### Experimental