From 019295226d7520aa0260278d6e53fa5a9fd9690c Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Mon, 11 May 2026 21:34:34 +0200 Subject: [PATCH] Sweep targeted typecheck errors: 11 fixes across 9 files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ProductImageUtility: 'CatalogPageMessageProductData.I' was clearly a placeholder/typo in the WALL branch — getProductCategory's first param is FurnitureType, so use the enclosing productType. - YouTubePlayerView: IRoomUserData has webID, not userId. Two spectator/watcher-list sites used the wrong field. - AvatarInfoWidgetView REQUEST_MANIPULATION handler: avatarInfo is IAvatarInfo (union); .category / .id only exist on AvatarInfoFurni. Type-guard before reading. - InfoStandWidgetPetView: deleted the duplicate local 'interface AvatarInfoPet' — was shadowing the imported one. Drop AvatarInfoPet from the import (local interface stands alone). - FurnitureExternalImageView: missing GetSessionDataManager import (the reportedUserId field reads it inline). Added. - GroupCreatorView setGroupData call: null values for groupName / groupDescription / groupColors / groupBadgeParts where IGroupData expects string / number[] / GroupBadgePart[]. Empty defaults. Also added the previously-omitted groupHasForum field. - ContextMenuView + WiredCreatorToolsView: 'return () => ticker.remove(updateOverlays)' — Pixi Ticker.remove() returns the ticker, leaking the value to React's EffectCallback cleanup which expects 'void | (() => void)'. Wrap in block body. - Deleted src/components/room/widgets/chat/ChatWidgetWindowView_old.tsx — dead code (zero references in the codebase), tripping the NitroCardHeaderView onCloseClick prop change. Net tsgo error count: -11. --- src/api/utils/ProductImageUtility.ts | 2 +- .../groups/views/GroupCreatorView.tsx | 9 +- .../avatar-info/AvatarInfoWidgetView.tsx | 3 +- .../infostand/InfoStandWidgetPetView.tsx | 2 +- .../widgets/chat/ChatWidgetWindowView_old.tsx | 93 ------------------- .../widgets/context-menu/ContextMenuView.tsx | 2 +- .../furniture/FurnitureExternalImageView.tsx | 1 + src/components/toolbar/YouTubePlayerView.tsx | 8 +- .../wired-tools/WiredCreatorToolsView.tsx | 2 +- 9 files changed, 16 insertions(+), 106 deletions(-) delete mode 100644 src/components/room/widgets/chat/ChatWidgetWindowView_old.tsx diff --git a/src/api/utils/ProductImageUtility.ts b/src/api/utils/ProductImageUtility.ts index 3f8fb80..55c241e 100644 --- a/src/api/utils/ProductImageUtility.ts +++ b/src/api/utils/ProductImageUtility.ts @@ -13,7 +13,7 @@ export class ProductImageUtility imageUrl = GetRoomEngine().getFurnitureFloorIconUrl(furniClassId); break; case FurnitureType.WALL: - const productCategory = this.getProductCategory(CatalogPageMessageProductData.I, furniClassId); + const productCategory = this.getProductCategory(productType, furniClassId); if(productCategory === 1) { diff --git a/src/components/groups/views/GroupCreatorView.tsx b/src/components/groups/views/GroupCreatorView.tsx index d0d24d1..f78b561 100644 --- a/src/components/groups/views/GroupCreatorView.tsx +++ b/src/components/groups/views/GroupCreatorView.tsx @@ -108,13 +108,14 @@ export const GroupCreatorView: FC = props => setGroupData({ groupId: -1, - groupName: null, - groupDescription: null, + groupName: '', + groupDescription: '', groupHomeroomId: -1, groupState: 1, groupCanMembersDecorate: true, - groupColors: null, - groupBadgeParts: null + groupHasForum: false, + groupColors: [], + groupBadgeParts: [] }); SendMessageComposer(new GroupBuyDataComposer()); diff --git a/src/components/room/widgets/avatar-info/AvatarInfoWidgetView.tsx b/src/components/room/widgets/avatar-info/AvatarInfoWidgetView.tsx index 7e4ea5c..8bbfd3f 100644 --- a/src/components/room/widgets/avatar-info/AvatarInfoWidgetView.tsx +++ b/src/components/room/widgets/avatar-info/AvatarInfoWidgetView.tsx @@ -81,7 +81,8 @@ export const AvatarInfoWidgetView: FC<{}> = props => useNitroEvent(RoomEngineObjectEvent.REQUEST_MANIPULATION, event => { - if(event.category !== avatarInfo?.category || event.objectId !== avatarInfo?.id) return; + if(!(avatarInfo instanceof AvatarInfoFurni)) return; + if(event.category !== avatarInfo.category || event.objectId !== avatarInfo.id) return; setMobileFurniDetailsOpen(false); }); diff --git a/src/components/room/widgets/avatar-info/infostand/InfoStandWidgetPetView.tsx b/src/components/room/widgets/avatar-info/infostand/InfoStandWidgetPetView.tsx index 1e1b557..db5f81a 100644 --- a/src/components/room/widgets/avatar-info/infostand/InfoStandWidgetPetView.tsx +++ b/src/components/room/widgets/avatar-info/infostand/InfoStandWidgetPetView.tsx @@ -1,7 +1,7 @@ import { CreateLinkEvent, PetRespectComposer, PetType } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState, useCallback } from 'react'; import { FaTimes } from 'react-icons/fa'; -import { AvatarInfoPet, ConvertSeconds, GetConfigurationValue, LocalizeText, SendMessageComposer } from '../../../../../api'; +import { ConvertSeconds, GetConfigurationValue, LocalizeText, SendMessageComposer } from '../../../../../api'; import { Button, Column, Flex, LayoutCounterTimeView, LayoutPetImageView, LayoutRarityLevelView, Text, UserProfileIconView } from '../../../../../common'; import { useRoom, useSessionInfo } from '../../../../../hooks'; diff --git a/src/components/room/widgets/chat/ChatWidgetWindowView_old.tsx b/src/components/room/widgets/chat/ChatWidgetWindowView_old.tsx deleted file mode 100644 index 46c6bc2..0000000 --- a/src/components/room/widgets/chat/ChatWidgetWindowView_old.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import { FC, UIEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { ChatEntryType } from '../../../../api'; -import { DraggableWindowPosition, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common'; -import { useChatHistory } from '../../../../hooks'; -import { useRoom } from '../../../../hooks/rooms'; - -const BOTTOM_SCROLL_THRESHOLD = 20; - -export const ChatWidgetWindowView: FC<{}> = () => -{ - const contentRef = useRef(null); - const lastScrollTop = useRef(0); - const [ isAutoScrollEnabled, setIsAutoScrollEnabled ] = useState(true); - const { chatHistory = [] } = useChatHistory(); - const { roomSession = null } = useRoom(); - - const roomChatHistory = useMemo(() => chatHistory.filter(chat => ((chat.type === ChatEntryType.TYPE_CHAT) && (chat.roomId === roomSession?.roomId))), [ chatHistory, roomSession?.roomId ]); - - const isAtBottom = useCallback((element: HTMLDivElement) => - { - const distanceToBottom = (element.scrollHeight - element.clientHeight - element.scrollTop); - - return (distanceToBottom <= BOTTOM_SCROLL_THRESHOLD); - }, []); - - const scrollToLatest = useCallback((smooth: boolean = true) => - { - if(!contentRef.current) return; - - const element = contentRef.current; - - element.scrollTo({ top: element.scrollHeight, behavior: smooth ? 'smooth' : 'auto' }); - }, []); - - const onScroll = useCallback((event: UIEvent) => - { - const element = event.currentTarget; - const atBottom = isAtBottom(element); - const isScrollingUp = (element.scrollTop < lastScrollTop.current); - - lastScrollTop.current = element.scrollTop; - - if(atBottom) - { - if(!isAutoScrollEnabled) setIsAutoScrollEnabled(true); - - return; - } - - if(isAutoScrollEnabled && isScrollingUp) setIsAutoScrollEnabled(false); - }, [ isAtBottom, isAutoScrollEnabled ]); - - useEffect(() => - { - if(!contentRef.current || !isAutoScrollEnabled) return; - - scrollToLatest(); - }, [ roomChatHistory.length, isAutoScrollEnabled, scrollToLatest ]); - - return ( - - - -
- { roomChatHistory.map(chat => ( -
-
-
- - -
-
- )) } -
- { !isAutoScrollEnabled && ( - - ) } - - - ); -}; diff --git a/src/components/room/widgets/context-menu/ContextMenuView.tsx b/src/components/room/widgets/context-menu/ContextMenuView.tsx index c45865f..6497f85 100644 --- a/src/components/room/widgets/context-menu/ContextMenuView.tsx +++ b/src/components/room/widgets/context-menu/ContextMenuView.tsx @@ -134,7 +134,7 @@ export const ContextMenuView: FC = ({ const ticker = GetTicker(); ticker.add(update); - return () => ticker.remove(update); + return () => { ticker.remove(update); }; }, [objectId, category, updatePosition, onClose]); useEffect(() => diff --git a/src/components/room/widgets/furniture/FurnitureExternalImageView.tsx b/src/components/room/widgets/furniture/FurnitureExternalImageView.tsx index 0ee52cf..f55ac1e 100644 --- a/src/components/room/widgets/furniture/FurnitureExternalImageView.tsx +++ b/src/components/room/widgets/furniture/FurnitureExternalImageView.tsx @@ -1,4 +1,5 @@ import { FC } from 'react'; +import { GetSessionDataManager } from '@nitrots/nitro-renderer'; import { GetConfigurationValue, LocalizeText, ReportType } from '../../../../api'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common'; import { useFurnitureExternalImageWidget, useHelp } from '../../../../hooks'; diff --git a/src/components/toolbar/YouTubePlayerView.tsx b/src/components/toolbar/YouTubePlayerView.tsx index c95a4c0..3140290 100644 --- a/src/components/toolbar/YouTubePlayerView.tsx +++ b/src/components/toolbar/YouTubePlayerView.tsx @@ -117,10 +117,10 @@ export const YouTubePlayerView: FC<{}> = () => for (let i = 0; i < 500; i++) { const userData = roomSession.userDataManager.getUserDataByIndex(i); - if (userData && userData.name && userData.type === 1 && !seen.has(userData.userId)) + if (userData && userData.name && userData.type === 1 && !seen.has(userData.webID)) { - seen.add(userData.userId); - users.push({ id: userData.userId, name: userData.name, look: userData.figure }); + seen.add(userData.webID); + users.push({ id: userData.webID, name: userData.name, look: userData.figure }); } } setSpectators(users); @@ -663,7 +663,7 @@ export const YouTubePlayerView: FC<{}> = () => const ud = rs.userDataManager.getUserData(uid); if (ud && ud.name) { - watchers.push({ id: ud.userId, name: ud.name, look: ud.figure }); + watchers.push({ id: ud.webID, name: ud.name, look: ud.figure }); } } } diff --git a/src/components/wired-tools/WiredCreatorToolsView.tsx b/src/components/wired-tools/WiredCreatorToolsView.tsx index 7c188fc..de5ae3b 100644 --- a/src/components/wired-tools/WiredCreatorToolsView.tsx +++ b/src/components/wired-tools/WiredCreatorToolsView.tsx @@ -1975,7 +1975,7 @@ export const WiredCreatorToolsView: FC<{}> = () => ticker.add(updateOverlays); - return () => ticker.remove(updateOverlays); + return () => { ticker.remove(updateOverlays); }; }, [ isVariableHighlightActive, roomSession?.roomId, variableHighlightTargets ]); const variableManageTypeOptions = useMemo(() => {