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
This commit is contained in:
2026-06-04 11:46:58 -04:00
parent b7edf6a82d
commit d519258942
5 changed files with 19 additions and 8 deletions
+2 -2
View File
@@ -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<ReturnType<typeof setInterval>>();
const idleRef = useRef<ReturnType<typeof setInterval> | 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
+4 -5
View File
@@ -28,7 +28,7 @@ export default function KiraAvatar(props: Props) {
const modelRef = useRef<any>(null);
const textureRef = useRef<any>(null);
const lipSyncRef = useRef<number>(0);
const idleExprRef = useRef<ReturnType<typeof setInterval>>();
const idleExprRef = useRef<ReturnType<typeof setInterval> | null>(null);
const [live2dReady, setLive2dReady] = useState(false);
const [loadError, setLoadError] = useState(false);
const [currentExpression, setCurrentExpression] = useState<ExpressionName>('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;
+1 -1
View File
@@ -1,4 +1,4 @@
import { SCENES, type Scene } from './scenes';
import { SCENES, type Scene } from '../components/scenes';
export interface KiraState {
currentScene: Scene;
+11
View File
@@ -0,0 +1,11 @@
/// <reference types="vite/client" />
declare module '*.css' {
const content: Record<string, string>;
export default content;
}
declare module '*.module.css' {
const classes: { readonly [key: string]: string };
export default classes;
}