no more ReturnType<typeof>
This commit is contained in:
+68
-12
@@ -1,6 +1,5 @@
|
||||
import type { RefObject } from 'react';
|
||||
import { MazeRenderer, MazeGenerator } from "./useBoard";
|
||||
import type { ScoreManager } from './useScore';
|
||||
export * from './useGame';
|
||||
export * from './useBoard';
|
||||
export * from './useCursor';
|
||||
@@ -35,7 +34,7 @@ export type CellTag = "wall" | "door" | PositionTag;
|
||||
|
||||
export type MazeCell = CellTag[];
|
||||
|
||||
export interface MazeData {
|
||||
export type MazeData = {
|
||||
maze: MazeCell[][];
|
||||
width: number;
|
||||
height: number;
|
||||
@@ -70,14 +69,15 @@ export type GameStatusManager = {
|
||||
export type CursorMode = 'normal' | 'insert' | 'replace' | 'visual' | 'visual-line';
|
||||
|
||||
export type UseHeroType = {
|
||||
heroPos: Coord | null;
|
||||
setHeroPos: (pos: Coord | null) => void;
|
||||
moveHero: (dr: number, dc: number, steps: number, gameStatus: GameStatus, setGameStatus: (s: GameStatus) => void) => void;
|
||||
position: Coord | null;
|
||||
canMoveTo: (coord: Coord) => boolean;
|
||||
moveTo: (coord: Coord) => void;
|
||||
pickupKey: () => void;
|
||||
reachExit: () => void;
|
||||
reset: () => void;
|
||||
heroPos: Coord | null;
|
||||
setHeroPos: (pos: Coord | null) => void;
|
||||
moveHero: (dr: number, dc: number, steps: number, gameStatus: GameStatus, setGameStatus: (s: GameStatus) => void) => void;
|
||||
};
|
||||
|
||||
export type CursorManager = {
|
||||
@@ -93,13 +93,13 @@ export type CursorManager = {
|
||||
moveToTop: () => void;
|
||||
moveToBottom: () => void;
|
||||
repeatLastMotion: () => void;
|
||||
resetCount: () => void;
|
||||
getCount: () => string;
|
||||
hasCount: () => boolean;
|
||||
setCount: (digit: string) => void;
|
||||
setLastKey: (key: string) => void;
|
||||
getLastKey: () => string;
|
||||
hero?: UseHeroType;
|
||||
resetCount: () => void;
|
||||
getCount: () => string;
|
||||
hasCount: () => boolean;
|
||||
setCount: (digit: string) => void;
|
||||
setLastKey: (key: string) => void;
|
||||
getLastKey: () => string;
|
||||
hero?: UseHeroType;
|
||||
}
|
||||
|
||||
export type HeroManager = {
|
||||
@@ -119,3 +119,59 @@ export type HeroRenderer = {
|
||||
|
||||
// Legacy type for backward compatibility
|
||||
export type Cursor = CursorManager;
|
||||
|
||||
export type Motion = { dr: number; dc: number; steps: number };
|
||||
|
||||
export type VimMotionSystem = {
|
||||
processKey: (key: string) => { type: 'move'|'anchor'|'repeat'|'count', data: any } | null;
|
||||
resetCount: () => void;
|
||||
getCount: () => number;
|
||||
hasCount: () => boolean;
|
||||
setLastMotion: (motion: Motion) => void;
|
||||
repeatLastMotion: () => Motion | null;
|
||||
};
|
||||
|
||||
export type AnimationSystem = {
|
||||
animateMovement: (from: Coord, to: Coord, steps: number, onStep: (coord: Coord) => void, onComplete: () => void) => void;
|
||||
cancelAnimation: () => void;
|
||||
isAnimating: () => boolean;
|
||||
};
|
||||
|
||||
export type MazeNavigator = {
|
||||
isValidMove: (from: Coord, to: Coord) => boolean;
|
||||
findAnchorTarget: (from: Coord, direction: 'left'|'right'|'top'|'bottom') => Coord | null;
|
||||
validatePath: (from: Coord, direction: Coord, steps: number) => boolean;
|
||||
};
|
||||
|
||||
export type HeroRenderManager = {
|
||||
render: () => void;
|
||||
updatePosition: (coord: Coord) => void;
|
||||
showCoordinates: (show: boolean) => void;
|
||||
};
|
||||
|
||||
export type TimerManager = {
|
||||
timeValue: number;
|
||||
startTimer: () => void;
|
||||
stopTimer: () => void;
|
||||
resetTimer: () => void;
|
||||
};
|
||||
|
||||
export type ScorePathsResult = {
|
||||
entranceToKey: number;
|
||||
entranceToExit: number;
|
||||
heroToKey: number;
|
||||
heroToExit: number;
|
||||
};
|
||||
|
||||
export type ScoreManager = {
|
||||
timeValue: number;
|
||||
startTimer: () => void;
|
||||
stopTimer: () => void;
|
||||
resetTimer: () => void;
|
||||
distToKey: number;
|
||||
distToExit: number;
|
||||
keystrokes: number;
|
||||
optimalSteps: number;
|
||||
efficiency: number;
|
||||
finalScore: number | null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user