Skip to content

Commit

Permalink
Add a correct TS signature for useEntityRecords (#44448)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel authored and ockham committed Sep 26, 2022
1 parent 93d7c76 commit 6178f16
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions packages/core-data/src/hooks/use-entity-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,26 @@ import deprecated from '@wordpress/deprecated';
*/
import useQuerySelect from './use-query-select';
import { store as coreStore } from '../';
import type { Options, EntityRecordResolution } from './use-entity-record';
import type { Options } from './use-entity-record';
import type { Status } from './constants';

type EntityRecordsResolution< RecordType > = Omit<
EntityRecordResolution< RecordType >,
'record'
> & {
interface EntityRecordsResolution< RecordType > {
/** The requested entity record */
records: RecordType[] | null;
};

/**
* Is the record still being resolved?
*/
isResolving: boolean;

/**
* Is the record resolved by now?
*/
hasResolved: boolean;

/** Resolution status */
status: Status;
}

const EMPTY_ARRAY = [];

Expand Down

0 comments on commit 6178f16

Please sign in to comment.