Skip to content

Commit

Permalink
chore: fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCG committed Oct 12, 2023
1 parent e0cb6a0 commit b650d25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/hooks/useViewportSize/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export {useViewportSize} from './useViewportSize';
export type {ViewportSizeResult} from './useViewportSize';
export type {UseViewportSizeResult} from './useViewportSize';
8 changes: 4 additions & 4 deletions src/hooks/useViewportSize/useViewportSize.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';

export interface ViewportSizeResult {
export interface UseViewportSizeResult {
width?: number;
height?: number;
}

const getViewportSize = (): ViewportSizeResult => ({
const getViewportSize = (): UseViewportSizeResult => ({
width: window?.visualViewport?.width ?? window?.innerWidth ?? undefined,
height: window?.visualViewport?.height ?? window?.innerHeight ?? undefined,
});
Expand All @@ -15,8 +15,8 @@ const getViewportSize = (): ViewportSizeResult => ({
*
* @return - {width, height}
*/
export const useViewportSize = (): ViewportSizeResult => {
const [size, setSize] = React.useState<ViewportSizeResult>(getViewportSize());
export const useViewportSize = (): UseViewportSizeResult => {
const [size, setSize] = React.useState<UseViewportSizeResult>(getViewportSize());

React.useEffect(() => {
const onResize = () => {
Expand Down

0 comments on commit b650d25

Please sign in to comment.