Skip to content

Commit

Permalink
Update a few function definitions (WordPress#66315)
Browse files Browse the repository at this point in the history
Co-authored-by: tyxla <[email protected]>
Co-authored-by: ciampo <[email protected]>
  • Loading branch information
3 people authored and karthick-murugan committed Nov 13, 2024
1 parent b8d584e commit 3775272
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions packages/components/src/spacer/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import { space } from '../utils/space';
import { rtl, useCx } from '../utils';
import type { SpacerProps } from './types';

const isDefined = < T >( o: T ): o is Exclude< T, null | undefined > =>
typeof o !== 'undefined' && o !== null;
function isDefined< T >( o: T ): o is Exclude< T, null | undefined > {
return typeof o !== 'undefined' && o !== null;
}

export function useSpacer(
props: WordPressComponentProps< SpacerProps, 'div' >
Expand Down
4 changes: 3 additions & 1 deletion packages/data-controls/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ export const __unstableAwaitPromise = function < T >( promise: Promise< T > ) {
* store.
*/
export const controls = {
AWAIT_PROMISE: < T >( { promise }: { promise: Promise< T > } ) => promise,
AWAIT_PROMISE< T >( { promise }: { promise: Promise< T > } ) {
return promise;
},
API_FETCH( { request }: { request: APIFetchOptions } ) {
return triggerFetch( request );
},
Expand Down
6 changes: 3 additions & 3 deletions packages/fields/src/mutation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { dispatch } from '@wordpress/data';
*/
import type { CoreDataError, Post } from '../types';

const getErrorMessagesFromPromises = < T >(
function getErrorMessagesFromPromises< T >(
allSettledResults: PromiseSettledResult< T >[]
) => {
) {
const errorMessages = new Set< string >();
// If there was at lease one failure.
if ( allSettledResults.length === 1 ) {
Expand All @@ -36,7 +36,7 @@ const getErrorMessagesFromPromises = < T >(
}
}
return errorMessages;
};
}

export type NoticeSettings< T extends Post > = {
success: {
Expand Down

0 comments on commit 3775272

Please sign in to comment.