Skip to content

Commit 6ac7ae0

Browse files
authored
🤖 Merge PR DefinitelyTyped#74278 [@wordpress/block-editor] Updated the useTypographyProps definition to allow newer options by @Toberumono
1 parent a1ec370 commit 6ac7ae0

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import { BlockAttributes } from "@wordpress/blocks";
2+
import { GlobalStylesSettings } from "@wordpress/global-styles-engine";
23

34
/**
45
* Provides the CSS class names and inline styles for a block's typography support
56
* attributes.
67
*
78
* @param attributes Block attributes.
89
* @param fluidTypographySettings If boolean, whether the function should try to convert font sizes to fluid values,
9-
* otherwise an object containing theme fluid typography settings.
10+
* otherwise an object containing theme (typography) settings.
1011
*
1112
* @return Typography block support derived CSS classes & styles.
1213
*/
1314
export function getTypographyClassesAndStyles(
1415
attributes: BlockAttributes,
15-
fluidTypographySettings: { minFontSize?: string } | boolean,
16+
fluidTypographySettings?: { minFontSize?: string } | GlobalStylesSettings | boolean,
1617
): { className: string; style: Record<string, string> };

‎types/wordpress__block-editor/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@wordpress/components": "^29.12.0",
1212
"@wordpress/data": "^10.26.0",
1313
"@wordpress/element": "^6.26.0",
14+
"@wordpress/global-styles-engine": "^1.4.0",
1415
"@wordpress/keycodes": "^4.26.0",
1516
"react-autosize-textarea": "^7.1.0"
1617
},

‎types/wordpress__block-editor/wordpress__block-editor-tests.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,9 @@ be.getTypographyClassesAndStyles({}, false).style;
683683
be.getTypographyClassesAndStyles({}, {}).style;
684684
be.getTypographyClassesAndStyles({}, { minFontSize: "33" }).style;
685685

686+
// $ExpectType string
687+
be.getTypographyClassesAndStyles({}).className;
688+
686689
// $ExpectType "HELLO"
687690
be.useCachedTruthy("HELLO");
688691

0 commit comments

Comments
 (0)