From d519258942281d5031e1562cdd0cbad61e9ece51 Mon Sep 17 00:00:00 2001 From: hobokenchicken Date: Thu, 4 Jun 2026 11:46:58 -0400 Subject: [PATCH] fix: TypeScript build errors in Docker - useRef(null) initial values for Strict TS 6.0 - Removed deprecated transparent option in pixi v7 - Cast Live2DModel to any for addChild type compat - Cast coreModel for getTexture access - Fixed types/index.ts import path to scenes - Added vite-env.d.ts with CSS module declarations - Added null-coalesce for clearInterval calls --- frontend/src/components/AnimatedAvatar.tsx | 4 ++-- frontend/src/components/KiraAvatar.tsx | 9 ++++----- frontend/src/types/index.ts | 2 +- frontend/src/vite-env.d.ts | 11 +++++++++++ frontend/tsconfig.tsbuildinfo | 1 + 5 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 frontend/src/vite-env.d.ts create mode 100644 frontend/tsconfig.tsbuildinfo diff --git a/frontend/src/components/AnimatedAvatar.tsx b/frontend/src/components/AnimatedAvatar.tsx index 87ea957..7d39d88 100644 --- a/frontend/src/components/AnimatedAvatar.tsx +++ b/frontend/src/components/AnimatedAvatar.tsx @@ -13,7 +13,7 @@ export default function AnimatedAvatar({ isSpeaking, isListening, outfit, access const [wave, setWave] = useState(false); const [lookX, setLookX] = useState(0); const [lookY, setLookY] = useState(0); - const idleRef = useRef>(); + const idleRef = useRef | null>(null); // Blink cycle useEffect(() => { @@ -31,7 +31,7 @@ export default function AnimatedAvatar({ isSpeaking, isListening, outfit, access setLookX(Math.sin(Date.now() / 3000) * 3); setLookY(Math.sin(Date.now() / 4000) * 2); }, 100); - return () => clearInterval(idleRef.current); + return () => clearInterval(idleRef.current ?? undefined); }, []); // Wave gesture on toggle diff --git a/frontend/src/components/KiraAvatar.tsx b/frontend/src/components/KiraAvatar.tsx index 608bc7a..b27b4d1 100644 --- a/frontend/src/components/KiraAvatar.tsx +++ b/frontend/src/components/KiraAvatar.tsx @@ -28,7 +28,7 @@ export default function KiraAvatar(props: Props) { const modelRef = useRef(null); const textureRef = useRef(null); const lipSyncRef = useRef(0); - const idleExprRef = useRef>(); + const idleExprRef = useRef | null>(null); const [live2dReady, setLive2dReady] = useState(false); const [loadError, setLoadError] = useState(false); const [currentExpression, setCurrentExpression] = useState('Normal'); @@ -56,7 +56,6 @@ export default function KiraAvatar(props: Props) { const app = new Application({ width: size, height: size * 1.25, - transparent: true, antialias: true, resolution: Math.min(window.devicePixelRatio || 1, 2), backgroundAlpha: 0, @@ -80,13 +79,13 @@ export default function KiraAvatar(props: Props) { model.anchor.set(0.5, 0.5); model.position.set(app.screen.width / 2, app.screen.height / 2 + 6); - app.stage.addChild(model); + app.stage.addChild(model as any); // Store reference to texture_02 for outfit swapping try { textureRef.current = { index: 2, - original: model.internalModel.coreModel.getTexture(2), + original: (model.internalModel.coreModel as any).getTexture(2), }; } catch { /* ignore */ } @@ -113,7 +112,7 @@ export default function KiraAvatar(props: Props) { return () => { mounted = false; cancelAnimationFrame(lipSyncRef.current); - clearInterval(idleExprRef.current); + clearInterval(idleExprRef.current ?? undefined); if (appRef.current) { appRef.current.destroy(true, { children: true }); appRef.current = null; diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index 2d06df6..3fb762e 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -1,4 +1,4 @@ -import { SCENES, type Scene } from './scenes'; +import { SCENES, type Scene } from '../components/scenes'; export interface KiraState { currentScene: Scene; diff --git a/frontend/src/vite-env.d.ts b/frontend/src/vite-env.d.ts new file mode 100644 index 0000000..9d1bb16 --- /dev/null +++ b/frontend/src/vite-env.d.ts @@ -0,0 +1,11 @@ +/// + +declare module '*.css' { + const content: Record; + export default content; +} + +declare module '*.module.css' { + const classes: { readonly [key: string]: string }; + export default classes; +} diff --git a/frontend/tsconfig.tsbuildinfo b/frontend/tsconfig.tsbuildinfo new file mode 100644 index 0000000..9f8e41c --- /dev/null +++ b/frontend/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"root":["./src/App.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/AnimatedAvatar.tsx","./src/components/BackgroundScene.tsx","./src/components/ChatBubble.tsx","./src/components/Clock.tsx","./src/components/KiraAvatar.tsx","./src/components/MusicPlayer.tsx","./src/components/Notes.tsx","./src/components/Particles.tsx","./src/components/PetZone.tsx","./src/components/Timer.tsx","./src/components/Toolbar.tsx","./src/components/Wardrobe.tsx","./src/components/WelcomeScreen.tsx","./src/components/scenes.ts","./src/hooks/useConversation.ts","./src/types/index.ts"],"version":"6.0.3"} \ No newline at end of file