From a6f51d0822cd1474bd1d45eaaca5699f257a9103 Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Sat, 17 Jan 2026 23:13:47 +0300 Subject: [PATCH] Fix TypeScript errors and update dependencies - Fix ReactPortal return types in PopupWindow, Tooltip, Modal - Fix RefObject type compatibility for React 18 - Update extension-dapp dependency to 0.62.19 - Update vanitygen dependency to 1.0.1 - Add eslint-scope resolution for webpack - Remove unused @ts-expect-error directives - Update mobile test snapshots --- .../DashboardScreen.test.tsx.snap | 24 +++++-- .../__snapshots__/SwapScreen.test.tsx.snap | 67 +------------------ pezkuwi-sdk-ui/package.json | 5 +- .../packages/page-accounts/package.json | 2 +- .../packages/page-claims/src/index.tsx | 1 - .../src/Referenda/Submit/TrackDropdown.tsx | 6 +- .../packages/react-api/package.json | 6 +- .../src/AccountSidebar/AddressSection.tsx | 3 +- .../AccountSidebar/SidebarEditableSection.tsx | 2 +- .../react-components/src/CopyButton.tsx | 1 - .../react-components/src/Modal/index.tsx | 2 +- .../src/Popup/PopupWindow.tsx | 4 +- .../react-components/src/Popup/types.ts | 4 +- .../packages/react-components/src/Sidebar.tsx | 4 +- .../packages/react-components/src/Tooltip.tsx | 2 +- .../react-hooks/src/useOutsideClick.ts | 4 +- .../react-hooks/src/usePopupWindow.ts | 2 +- 17 files changed, 44 insertions(+), 95 deletions(-) diff --git a/mobile/src/screens/__tests__/__snapshots__/DashboardScreen.test.tsx.snap b/mobile/src/screens/__tests__/__snapshots__/DashboardScreen.test.tsx.snap index df1c2782..7a23ff67 100644 --- a/mobile/src/screens/__tests__/__snapshots__/DashboardScreen.test.tsx.snap +++ b/mobile/src/screens/__tests__/__snapshots__/DashboardScreen.test.tsx.snap @@ -942,18 +942,28 @@ exports[`DashboardScreen should match snapshot 1`] = ` ] } > - - FINANCE 💰 - + + FINANCE 💰 + + - - - ← - - - - Swap Tokens - { /> )}
{t('Copy the following string and sign it with the Ethereum account you used during the pre-sale in the wallet of your choice, using the string as the payload, and then paste the transaction signature object below:')}
- {/* @ts-expect-error React 18 type compatibility */} = styled(TrackDropdown)` .trackOption { .faded { font-size: var(--font-size-small); @@ -44,4 +44,6 @@ export default React.memo(styled(TrackDropdown)` opacity: 0.6; } } -`); +`; + +export default React.memo(StyledTrackDropdown); diff --git a/pezkuwi-sdk-ui/packages/react-api/package.json b/pezkuwi-sdk-ui/packages/react-api/package.json index 49773538..8a197daf 100644 --- a/pezkuwi-sdk-ui/packages/react-api/package.json +++ b/pezkuwi-sdk-ui/packages/react-api/package.json @@ -21,9 +21,9 @@ }, "dependencies": { "@pezkuwi/api": "^16.5.6", - "@pezkuwi/extension-compat-metamask": "^0.62.14", - "@pezkuwi/extension-dapp": "^0.62.14", - "@pezkuwi/extension-inject": "^0.62.14", + "@pezkuwi/extension-compat-metamask": "^0.62.19", + "@pezkuwi/extension-dapp": "^0.62.19", + "@pezkuwi/extension-inject": "^0.62.19", "@pezkuwi/rpc-provider": "^16.5.6", "fflate": "^0.8.1", "rxjs": "^7.8.1" diff --git a/pezkuwi-sdk-ui/packages/react-components/src/AccountSidebar/AddressSection.tsx b/pezkuwi-sdk-ui/packages/react-components/src/AccountSidebar/AddressSection.tsx index 3744fb68..3f06dbb5 100644 --- a/pezkuwi-sdk-ui/packages/react-components/src/AccountSidebar/AddressSection.tsx +++ b/pezkuwi-sdk-ui/packages/react-components/src/AccountSidebar/AddressSection.tsx @@ -65,8 +65,7 @@ function AddressSection ({ accountIndex, defaultValue, editingName, flags, onCha
- {/* @ts-expect-error React 18 type compatibility */} - diff --git a/pezkuwi-sdk-ui/packages/react-components/src/AccountSidebar/SidebarEditableSection.tsx b/pezkuwi-sdk-ui/packages/react-components/src/AccountSidebar/SidebarEditableSection.tsx index 0c48b2eb..e95f39c0 100644 --- a/pezkuwi-sdk-ui/packages/react-components/src/AccountSidebar/SidebarEditableSection.tsx +++ b/pezkuwi-sdk-ui/packages/react-components/src/AccountSidebar/SidebarEditableSection.tsx @@ -16,7 +16,7 @@ interface Props { address: string; isBeingEdited: (arg: boolean) => void; onUpdateName?: (() => void) | null; - sidebarRef: React.RefObject; + sidebarRef: React.RefObject; } function SidebarEditableSection ({ accountIndex, address, isBeingEdited, onUpdateName, sidebarRef }: Props): React.ReactElement { diff --git a/pezkuwi-sdk-ui/packages/react-components/src/CopyButton.tsx b/pezkuwi-sdk-ui/packages/react-components/src/CopyButton.tsx index e6112599..ec486ea3 100644 --- a/pezkuwi-sdk-ui/packages/react-components/src/CopyButton.tsx +++ b/pezkuwi-sdk-ui/packages/react-components/src/CopyButton.tsx @@ -46,7 +46,6 @@ function CopyButton ({ children, className = '', icon = 'copy', label, type, val return ( - {/* @ts-expect-error React 18 type compatibility */} { +function ModalBase ({ children, className = '', header, onClose, size = 'medium', testId = 'modal' }: Props): React.ReactPortal { const { themeClassName } = useTheme(); const listenKeyboard = useCallback((event: KeyboardEvent) => { diff --git a/pezkuwi-sdk-ui/packages/react-components/src/Popup/PopupWindow.tsx b/pezkuwi-sdk-ui/packages/react-components/src/Popup/PopupWindow.tsx index 7d5018b4..63ade467 100644 --- a/pezkuwi-sdk-ui/packages/react-components/src/Popup/PopupWindow.tsx +++ b/pezkuwi-sdk-ui/packages/react-components/src/Popup/PopupWindow.tsx @@ -10,14 +10,14 @@ import { usePopupWindow } from '@pezkuwi/react-hooks/usePopupWindow'; import { styled } from '../styled.js'; -function PopupWindow ({ children, className = '', position, triggerRef, windowRef }: Props): React.ReactElement { +function PopupWindow ({ children, className = '', position, triggerRef, windowRef }: Props): React.ReactPortal { const { pointerStyle, renderCoords: { x, y } } = usePopupWindow(windowRef, triggerRef, position); return createPortal( } style={ (x && y && { transform: `translate3d(${x}px, ${y}px, 0)`, diff --git a/pezkuwi-sdk-ui/packages/react-components/src/Popup/types.ts b/pezkuwi-sdk-ui/packages/react-components/src/Popup/types.ts index 3298f72c..32db09c2 100644 --- a/pezkuwi-sdk-ui/packages/react-components/src/Popup/types.ts +++ b/pezkuwi-sdk-ui/packages/react-components/src/Popup/types.ts @@ -17,8 +17,8 @@ export type VerticalPosition = 'top' | 'bottom' export interface PopupWindowProps { className?: string; children?: React.ReactNode; - windowRef: React.RefObject; - triggerRef: React.RefObject; + windowRef: React.RefObject; + triggerRef: React.RefObject; position: HorizontalPosition; } diff --git a/pezkuwi-sdk-ui/packages/react-components/src/Sidebar.tsx b/pezkuwi-sdk-ui/packages/react-components/src/Sidebar.tsx index 2060b267..09f5d031 100644 --- a/pezkuwi-sdk-ui/packages/react-components/src/Sidebar.tsx +++ b/pezkuwi-sdk-ui/packages/react-components/src/Sidebar.tsx @@ -14,7 +14,7 @@ interface Props { offset?: number | string; onClose?: () => void; position: 'left' | 'right'; - sidebarRef: React.RefObject; + sidebarRef: React.RefObject; } function Sidebar ({ buttons, children, className = '', dataTestId = '', onClose, position, sidebarRef }: Props): React.ReactElement { @@ -22,7 +22,7 @@ function Sidebar ({ buttons, children, className = '', dataTestId = '', onClose, } > {buttons} diff --git a/pezkuwi-sdk-ui/packages/react-components/src/Tooltip.tsx b/pezkuwi-sdk-ui/packages/react-components/src/Tooltip.tsx index 75179313..d6e926ce 100644 --- a/pezkuwi-sdk-ui/packages/react-components/src/Tooltip.tsx +++ b/pezkuwi-sdk-ui/packages/react-components/src/Tooltip.tsx @@ -22,7 +22,7 @@ interface Props { trigger: string; } -function Tooltip ({ children, className = '', isClickable = false, place, text, trigger }: Props): React.ReactElement | null { +function Tooltip ({ children, className = '', isClickable = false, place, text, trigger }: Props): React.ReactPortal { const [tooltipContainer] = useState( typeof document === 'undefined' ? {} as HTMLElement // This hack is required for server side rendering diff --git a/pezkuwi-sdk-ui/packages/react-hooks/src/useOutsideClick.ts b/pezkuwi-sdk-ui/packages/react-hooks/src/useOutsideClick.ts index c756fad6..994bbb91 100644 --- a/pezkuwi-sdk-ui/packages/react-hooks/src/useOutsideClick.ts +++ b/pezkuwi-sdk-ui/packages/react-hooks/src/useOutsideClick.ts @@ -7,14 +7,14 @@ import { useCallback, useEffect } from 'react'; import { createNamedHook } from './createNamedHook.js'; -function isRefClicked (refs: React.RefObject[], e: MouseEvent): boolean { +function isRefClicked (refs: React.RefObject[], e: MouseEvent): boolean { return refs.some((r) => r.current && r.current.contains(e.target as HTMLElement) ); } -function useOutsideClickImpl (refs: React.RefObject[], callback: () => void): void { +function useOutsideClickImpl (refs: React.RefObject[], callback: () => void): void { const handleClick = useCallback( (e: MouseEvent): void => { if (refs.length && !isRefClicked(refs, e)) { diff --git a/pezkuwi-sdk-ui/packages/react-hooks/src/usePopupWindow.ts b/pezkuwi-sdk-ui/packages/react-hooks/src/usePopupWindow.ts index f20e73e0..29045523 100644 --- a/pezkuwi-sdk-ui/packages/react-hooks/src/usePopupWindow.ts +++ b/pezkuwi-sdk-ui/packages/react-hooks/src/usePopupWindow.ts @@ -25,7 +25,7 @@ interface Result { const COORD_0: Coord = { x: 0, y: 0 }; -function usePopupWindowImpl (windowRef: React.RefObject, triggerRef: React.RefObject, position: HorizontalPosition): Result { +function usePopupWindowImpl (windowRef: React.RefObject, triggerRef: React.RefObject, position: HorizontalPosition): Result { const [renderCoords, setRenderCoords] = useState(COORD_0); const [pointerStyle, setPointerStyle] = useState('top'); const windowCoords = useElementPosition(windowRef);