Skip to content

Commit

Permalink
Update Ref type
Browse files Browse the repository at this point in the history
  • Loading branch information
shoonia committed Dec 24, 2024
1 parent 96ac6fd commit 91278c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ declare global {
interface ElementChildrenAttribute { children: {} }

type FC<P = {}> = (props: PropsWithChildren<P>) => Element | null
type Ref<T> = RefCallback<T> | RefObject<T>
type Ref<T = unknown> = RefCallback<T> | RefObject<T>

type AnimationEventListener<T = globalThis.Element> = EvHandler<AnimationEvent, T>
type ClipboardEventListener<T = globalThis.Element> = EvHandler<ClipboardEvent, T>
Expand Down
3 changes: 3 additions & 0 deletions tests/types-tests/ref.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ export const ref0: JSX.Ref<Element> = (node) => node.tagName;
export const ref1: JSX.Ref<HTMLElement> = (node) => node.tagName;
export const ref2: JSX.Ref<SVGAElement> = (node) => node.tagName;
export const ref3: JSX.Ref<MathMLElement> = (node) => node.tagName;

export const ref4: JSX.Ref = (node) => node;
export const ref5: JSX.Ref = { current: null };

0 comments on commit 91278c6

Please sign in to comment.