diff --git a/packages/data/README.md b/packages/data/README.md index 5509394de3612..67438a80eebe5 100644 --- a/packages/data/README.md +++ b/packages/data/README.md @@ -859,16 +859,16 @@ _Returns_ ### useSuspenseSelect -A variant of the `useSelect` hook that has the same API, but will throw a suspense Promise if any of the called selectors is in an unresolved state. +A variant of the `useSelect` hook that has the same API, but is a compatible Suspense-enabled data source. _Parameters_ -- _mapSelect_ `Function`: Function called on every state change. The returned value is exposed to the component using this hook. The function receives the `registry.suspendSelect` method as the first argument and the `registry` as the second one. +- _mapSelect_ `T`: Function called on every state change. The returned value is exposed to the component using this hook. The function receives the `registry.suspendSelect` method as the first argument and the `registry` as the second one. - _deps_ `Array`: A dependency array used to memoize the `mapSelect` so that the same `mapSelect` is invoked on every state change unless the dependencies change. _Returns_ -- `Object`: Data object returned by the `mapSelect` function. +- `ReturnType`: Data object returned by the `mapSelect` function. ### withDispatch diff --git a/packages/data/src/components/use-select/index.js b/packages/data/src/components/use-select/index.js index 9afb4a6cfbdc6..d047e7265908c 100644 --- a/packages/data/src/components/use-select/index.js +++ b/packages/data/src/components/use-select/index.js @@ -319,19 +319,23 @@ export default function useSelect( mapSelect, deps ) { } /** - * A variant of the `useSelect` hook that has the same API, but will throw a - * suspense Promise if any of the called selectors is in an unresolved state. + * A variant of the `useSelect` hook that has the same API, but is a compatible + * Suspense-enabled data source. * - * @param {Function} mapSelect Function called on every state change. The - * returned value is exposed to the component - * using this hook. The function receives the - * `registry.suspendSelect` method as the first - * argument and the `registry` as the second one. - * @param {Array} deps A dependency array used to memoize the `mapSelect` - * so that the same `mapSelect` is invoked on every - * state change unless the dependencies change. + * @template {MapSelect} T + * @param {T} mapSelect Function called on every state change. The + * returned value is exposed to the component + * using this hook. The function receives the + * `registry.suspendSelect` method as the first + * argument and the `registry` as the second one. + * @param {Array} deps A dependency array used to memoize the `mapSelect` + * so that the same `mapSelect` is invoked on every + * state change unless the dependencies change. * - * @return {Object} Data object returned by the `mapSelect` function. + * @throws {Promise} A suspense Promise that is thrown if any of the called + * selectors is in an unresolved state. + * + * @return {ReturnType} Data object returned by the `mapSelect` function. */ export function useSuspenseSelect( mapSelect, deps ) { return useMappingSelect( true, mapSelect, deps );