From 2f1a5f82ec983f3d3d9b2cec400e59a5c3872af4 Mon Sep 17 00:00:00 2001 From: Matt Sherman Date: Tue, 26 Sep 2023 20:55:22 -0400 Subject: [PATCH] Add ProductEditorContext and ProductEditorBlockEditProps interfaces --- packages/js/product-editor/src/index.ts | 5 +++++ packages/js/product-editor/src/types.ts | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 packages/js/product-editor/src/types.ts diff --git a/packages/js/product-editor/src/index.ts b/packages/js/product-editor/src/index.ts index 511ba936c76..878a63d638a 100644 --- a/packages/js/product-editor/src/index.ts +++ b/packages/js/product-editor/src/index.ts @@ -6,6 +6,11 @@ export { TRACKS_SOURCE, } from './constants'; +/** + * Types + */ +export * from './types'; + /** * Utils */ diff --git a/packages/js/product-editor/src/types.ts b/packages/js/product-editor/src/types.ts new file mode 100644 index 00000000000..96e0434dda2 --- /dev/null +++ b/packages/js/product-editor/src/types.ts @@ -0,0 +1,18 @@ +/** + * External dependencies + */ +import { BlockEditProps } from '@wordpress/blocks'; +import { Product } from '@woocommerce/data'; + +export interface ProductEditorContext { + editedProduct: Product; + postId: number; + postType: string; + selectedTab: string | null; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export interface ProductEditorBlockEditProps< T extends Record< string, any > > + extends BlockEditProps< T > { + readonly context: ProductEditorContext; +}