diff --git a/packages/icons/src/index.ts b/packages/icons/src/index.ts index e4a0bd05d..693072cfe 100644 --- a/packages/icons/src/index.ts +++ b/packages/icons/src/index.ts @@ -8,11 +8,13 @@ declare global { interface Window { PixivIcon: typeof PixivIcon } +} +declare module 'react' { // eslint-disable-next-line @typescript-eslint/no-namespace - export namespace JSX { + namespace JSX { interface IntrinsicElements { - 'pixiv-icon': Props + 'pixiv-icon': import('./PixivIcon').Props } } } diff --git a/packages/react-sandbox/src/components/TextEllipsis/helper.ts b/packages/react-sandbox/src/components/TextEllipsis/helper.ts index d6ff8e8c3..746cd0edb 100644 --- a/packages/react-sandbox/src/components/TextEllipsis/helper.ts +++ b/packages/react-sandbox/src/components/TextEllipsis/helper.ts @@ -1,12 +1,6 @@ // https://github.com/fernandopasik/react-children-utilities/blob/971d8a0324e6183734d8d1af9a65dbad18ab3d00/src/lib/onlyText.ts -import { - Children, - isValidElement, - ReactElement, - ReactNode, - ReactText, -} from 'react' +import { Children, isValidElement, ReactElement, ReactNode } from 'react' const hasChildren = ( element: ReactNode @@ -16,7 +10,7 @@ const hasChildren = ( export const childToString = ( // eslint-disable-next-line @typescript-eslint/ban-types - child?: ReactText | boolean | {} | null + child?: number | string | boolean | {} | null ): string => { if ( typeof child === 'undefined' || diff --git a/packages/react-sandbox/src/foundation/hooks.ts b/packages/react-sandbox/src/foundation/hooks.ts index 834ee3013..383c0c02d 100644 --- a/packages/react-sandbox/src/foundation/hooks.ts +++ b/packages/react-sandbox/src/foundation/hooks.ts @@ -96,7 +96,7 @@ function measure(ref: Element | null): ElementSize | undefined { } export function useElementSize( - ref: React.RefObject, + ref: React.RefObject, // eslint-disable-next-line @typescript-eslint/no-explicit-any deps: any[] = [] ) { @@ -174,7 +174,7 @@ export function useElementSize( */ export function useDebounceAnimationState(defaultValue: T) { const [state, setState] = useState(defaultValue) - const timer = useRef>() + const timer = useRef | null>(null) // typescript bug? (any when omitting type annotation) // eslint-disable-next-line @typescript-eslint/no-inferrable-types const setDebounceState = useCallback((value: T, force: boolean = false) => { @@ -182,13 +182,13 @@ export function useDebounceAnimationState(defaultValue: T) { setState(value) return } - if (timer.current !== undefined) { + if (timer.current !== null) { return } timer.current = requestAnimationFrame(() => { setState(value) - if (timer.current !== undefined) { - timer.current = undefined + if (timer.current !== null) { + timer.current = null } }) }, []) diff --git a/packages/react/src/components/DropdownSelector/ListItem/index.tsx b/packages/react/src/components/DropdownSelector/ListItem/index.tsx index 6fff0581f..dd739e3ea 100644 --- a/packages/react/src/components/DropdownSelector/ListItem/index.tsx +++ b/packages/react/src/components/DropdownSelector/ListItem/index.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react' +import { ReactNode, type JSX } from 'react' import styled from 'styled-components' export type CustomJSXElement = diff --git a/packages/react/src/components/DropdownSelector/MenuList/MenuListContext.ts b/packages/react/src/components/DropdownSelector/MenuList/MenuListContext.ts index 014e9bfc6..895ab9206 100644 --- a/packages/react/src/components/DropdownSelector/MenuList/MenuListContext.ts +++ b/packages/react/src/components/DropdownSelector/MenuList/MenuListContext.ts @@ -2,7 +2,7 @@ import { RefObject, createContext } from 'react' import { DropdownMenuItemProps } from '../DropdownMenuItem' type MenuListContextType = { - root?: RefObject + root?: RefObject value?: string propsArray?: DropdownMenuItemProps[] setValue: (v: string) => void diff --git a/packages/react/src/components/DropdownSelector/Popover/index.tsx b/packages/react/src/components/DropdownSelector/Popover/index.tsx index adf970a9b..a4b3af7ec 100644 --- a/packages/react/src/components/DropdownSelector/Popover/index.tsx +++ b/packages/react/src/components/DropdownSelector/Popover/index.tsx @@ -9,8 +9,8 @@ export type PopoverProps = { isOpen: boolean onClose: () => void children: ReactNode - triggerRef: RefObject - popoverRef?: RefObject + triggerRef: RefObject + popoverRef?: RefObject } const _empty = () => null diff --git a/packages/react/src/components/Modal/useCustomModalOverlay.tsx b/packages/react/src/components/Modal/useCustomModalOverlay.tsx index 8127dcf5a..d649bb770 100644 --- a/packages/react/src/components/Modal/useCustomModalOverlay.tsx +++ b/packages/react/src/components/Modal/useCustomModalOverlay.tsx @@ -16,7 +16,7 @@ import { usePreventScroll } from '../DropdownSelector/Popover/usePreventScroll' export function useCharcoalModalOverlay( props: AriaModalOverlayProps, state: { isOpen: boolean; onClose: () => void }, - ref: React.RefObject + ref: React.RefObject ): ModalOverlayAria { const { overlayProps, underlayProps } = useOverlay( { diff --git a/packages/react/src/components/TextField/useFocusWithClick.tsx b/packages/react/src/components/TextField/useFocusWithClick.tsx index 4edd94f73..1463d1e10 100644 --- a/packages/react/src/components/TextField/useFocusWithClick.tsx +++ b/packages/react/src/components/TextField/useFocusWithClick.tsx @@ -2,8 +2,8 @@ import { useEffect } from 'react' import * as React from 'react' export function useFocusWithClick( - containerRef: React.RefObject, - inputRef: React.RefObject + containerRef: React.RefObject, + inputRef: React.RefObject ) { useEffect(() => { const el = containerRef.current diff --git a/packages/styled/src/index.test.tsx b/packages/styled/src/index.test.tsx index dfceecc35..036877559 100644 --- a/packages/styled/src/index.test.tsx +++ b/packages/styled/src/index.test.tsx @@ -6,6 +6,8 @@ import styled, { ThemeProvider } from 'styled-components' import { Example } from './index.story' import { MyTheme, myTheme } from './storyHelper' +import type { JSX } from 'react' + function render(children: JSX.Element) { return renderer .create({children})