Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ToolbarContext to TS #49002

Merged
merged 3 commits into from Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Expand Up @@ -21,6 +21,7 @@
- `navigateRegions` HOC: Convert to TypeScript ([#48632](https://github.com/WordPress/gutenberg/pull/48632)).
- `withSpokenMessages`: HOC: Convert to TypeScript ([#48163](https://github.com/WordPress/gutenberg/pull/48163)).
- `DimensionControl(Experimental)`: Convert to TypeScript ([#47351](https://github.com/WordPress/gutenberg/pull/47351)).
- `ToolbarContext`: Convert to TypeScript ([#49002](https://github.com/WordPress/gutenberg/pull/49002)).

## 23.5.0 (2023-03-01)

Expand Down
10 changes: 0 additions & 10 deletions packages/components/src/toolbar/toolbar-context/index.js

This file was deleted.

15 changes: 15 additions & 0 deletions packages/components/src/toolbar/toolbar-context/index.ts
@@ -0,0 +1,15 @@
/**
* External dependencies
*/
import type { ToolbarStateReturn } from 'reakit/Toolbar';

/**
* WordPress dependencies
*/
import { createContext } from '@wordpress/element';

const ToolbarContext = createContext< ToolbarStateReturn | undefined >(
undefined
);
Comment on lines +11 to +13
Copy link
Contributor Author

@mike-day mike-day Mar 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ToolbarStateReturn was used for this generic as it is the inferred type for toolbarState.

Please refer to ToolbarContainer.


export default ToolbarContext;