Skip to content

Commit

Permalink
Add return and fix/improve JSDoc types
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Apr 5, 2024
1 parent cfe46a0 commit f0ebfe3
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions packages/interactivity/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,13 @@ export function useLayoutEffect( callback, inputs ) {
* scope available so functions like `getElement()` and `getContext()` can be
* used inside the passed callback.
*
* @param {Function} callback Callback function.
* @param {any[]} inputs If present, the callback will only be updated if the
* values in the list change (using `===`).
* @template {Function} T The callback function type.
*
* @param {T} callback Callback function.
* @param {ReadonlyArray<unknown>} inputs If present, the callback will only be updated if the
* values in the list change (using `===`).
*
* @return {T} The callback function.
*/
export function useCallback( callback, inputs ) {
return _useCallback( withScope( callback ), inputs );
Expand All @@ -202,9 +206,13 @@ export function useCallback( callback, inputs ) {
* available so functions like `getElement()` and `getContext()` can be used
* inside the passed factory function.
*
* @param {Function} factory Factory function that returns that value for memoization.
* @param {any[]} inputs If present, the factory will only be run to recompute if the
* values in the list change (using `===`).
* @template {unknown} T The momized value.
*
* @param {() => T} factory Factory function that returns that value for memoization.
* @param {ReadonlyArray<unknown>} inputs If present, the factory will only be run to recompute if
* the values in the list change (using `===`).
*
* @return {T} The memoized value.
*/
export function useMemo( factory, inputs ) {
return _useMemo( withScope( factory ), inputs );
Expand Down

0 comments on commit f0ebfe3

Please sign in to comment.