Skip to content

Commit

Permalink
fix: useMeasure type definitions for SVG
Browse files Browse the repository at this point in the history
  • Loading branch information
robinvw1 committed Mar 11, 2021
1 parent 6ee97ec commit e200f7f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/useMeasure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export type UseMeasureRect = Pick<
DOMRectReadOnly,
'x' | 'y' | 'top' | 'left' | 'right' | 'bottom' | 'height' | 'width'
>;
export type UseMeasureRef<E extends HTMLElement = HTMLElement> = (element: E) => void;
export type UseMeasureResult<E extends HTMLElement = HTMLElement> = [
export type UseMeasureRef<E extends Element = Element> = (element: E) => void;
export type UseMeasureResult<E extends Element = Element> = [
UseMeasureRef<E>,
UseMeasureRect
];
Expand All @@ -23,7 +23,7 @@ const defaultState: UseMeasureRect = {
right: 0,
};

function useMeasure<E extends HTMLElement = HTMLElement>(): UseMeasureResult<E> {
function useMeasure<E extends Element = Element>(): UseMeasureResult<E> {
const [element, ref] = useState<E | null>(null);
const [rect, setRect] = useState<UseMeasureRect>(defaultState);

Expand Down

0 comments on commit e200f7f

Please sign in to comment.