From ee1e87358f7fe5adfe41c50fc411be15b2521c9c Mon Sep 17 00:00:00 2001 From: Jan Jakes Date: Tue, 10 May 2022 16:09:38 +0200 Subject: [PATCH] Add missing types for useSetting [MAILPOET-4323] --- mailpoet/assets/js/src/types/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mailpoet/assets/js/src/types/index.ts b/mailpoet/assets/js/src/types/index.ts index a391f76ea5..e548628f85 100644 --- a/mailpoet/assets/js/src/types/index.ts +++ b/mailpoet/assets/js/src/types/index.ts @@ -1,3 +1,5 @@ +import { ColorPalette, FontSizePicker } from '@wordpress/components'; + export * from '../segments/dynamic/types'; // Inspired by: https://neliosoftware.com/blog/adding-typescript-to-wordpress-data-stores/ @@ -15,4 +17,11 @@ export type OmitFirstArgs = { declare module '@wordpress/block-editor' { // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/naming-convention,no-underscore-dangle export const __experimentalLibrary: any; + + // types for 'useSetting' are missing in @types/wordpress__block-editor + export function useSetting(path: string): unknown; + export function useSetting(path: 'color.palette'): ColorPalette.Color[]; + export function useSetting( + path: 'typography.fontSizes', + ): FontSizePicker.FontSize[]; }