Skip to content

Commit

Permalink
Use a more readable generic type parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed May 21, 2021
1 parent cbdcf12 commit 402f53d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ return <div ref={ mergedRefs } />;

_Parameters_

- _refs_ `Array<T>`: The refs to be merged.
- _refs_ `Array<TRef>`: The refs to be merged.

_Returns_

- `import('react').RefCallback<TypeFromRef<T>>`: The merged ref callback.
- `import('react').RefCallback<TypeFromRef<TRef>>`: The merged ref callback.

<a name="usePrevious" href="#usePrevious">#</a> **usePrevious**

Expand Down
8 changes: 4 additions & 4 deletions packages/compose/src/hooks/use-merge-refs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ function assignRef( ref, value ) {
* return <div ref={ mergedRefs } />;
* ```
*
* @template {import('react').Ref<any>} T
* @param {Array<T>} refs The refs to be merged.
* @template {import('react').Ref<any>} TRef
* @param {Array<TRef>} refs The refs to be merged.
*
* @return {import('react').RefCallback<TypeFromRef<T>>} The merged ref callback.
* @return {import('react').RefCallback<TypeFromRef<TRef>>} The merged ref callback.
*/
export default function useMergeRefs( refs ) {
const element = useRef();
const didElementChange = useRef( false );
/* eslint-disable jsdoc/no-undefined-types */
/** @type {import('react').MutableRefObject<T[]>} */
/** @type {import('react').MutableRefObject<TRef[]>} */
/* eslint-enable jsdoc/no-undefined-types */
const previousRefs = useRef( [] );
const currentRefs = useRef( refs );
Expand Down

0 comments on commit 402f53d

Please sign in to comment.