Skip to content

Commit

Permalink
Update a few function definitions (#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 Oct 22, 2024
1 parent d0771cd commit 9fcb43b
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

1 comment on commit 9fcb43b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 9fcb43b.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11459916699
📝 Reported issues:

Please sign in to comment.