@@ -11,12 +11,18 @@ import { dispatch } from '@wordpress/data';
1111import border , {
1212 applyBorderStyleDefaults ,
1313 getBorderStyleFallbacks ,
14- getInheritedBorderStyles ,
14+ getInheritedBorderStyles as getInheritedBorderStylesFromSource ,
1515} from '../border' ;
1616import { store as blockEditorStore } from '../../store' ;
1717import { globalStylesDataKey } from '../../store/private-keys' ;
1818import { unlock } from '../../lock-unlock' ;
1919
20+ // The JSDoc marks both subtrees as required, but callers pass `undefined` for a missing level.
21+ const getInheritedBorderStyles = getInheritedBorderStylesFromSource as (
22+ blockBorder ?: object ,
23+ variationBorder ?: object
24+ ) => ReturnType < typeof getInheritedBorderStylesFromSource > ;
25+
2026vi . mock (
2127 import ( '../../components/use-settings' ) ,
2228 async ( importOriginal ) => ( {
@@ -284,6 +290,7 @@ describe( 'getBorderStyleFallbacks', () => {
284290 } ) ;
285291
286292 it ( 'returns empty when called with no arguments' , ( ) => {
293+ // @ts -expect-error The missing arguments are deliberate.
287294 expect ( getBorderStyleFallbacks ( ) ) . toEqual ( { } ) ;
288295 } ) ;
289296
@@ -439,18 +446,23 @@ describe( 'border useBlockProps', () => {
439446 const widthOnly = { border : { width : '2px' } } ;
440447
441448 // `updateSettings` drops symbol keys, so set the private key directly.
442- function setGlobalStyles ( styles ) {
449+ function setGlobalStyles ( styles : Record < string , unknown > | undefined ) {
443450 unlock ( dispatch ( blockEditorStore ) ) . __experimentalUpdateSettings ( {
444451 [ globalStylesDataKey ] : styles ,
445452 } ) ;
446453 }
447454
448- function getStyle ( props ) {
455+ type BorderBlockProps = Parameters < typeof border . useBlockProps > [ 0 ] ;
456+
457+ function getStyle ( props : Partial < BorderBlockProps > ) {
449458 const { result, unmount } = renderHook ( ( ) =>
450- border . useBlockProps ( { name : BLOCK_NAME , ...props } )
459+ border . useBlockProps ( {
460+ name : BLOCK_NAME ,
461+ ...props ,
462+ } as BorderBlockProps )
451463 ) ;
452464 unmount ( ) ;
453- return result . current . style ;
465+ return ( result . current as { style ?: Record < string , string > } ) . style ;
454466 }
455467
456468 beforeEach ( ( ) => {
0 commit comments