-
Notifications
You must be signed in to change notification settings - Fork 0
/
typings.d.ts
63 lines (54 loc) · 1.16 KB
/
typings.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
export enum Direction {
North = 'N',
West = 'W',
South = 'S',
East = 'E'
}
export const Move = {
[Direction.South]: [0, -1],
[Direction.West]: [-1, 0],
[Direction.North]: [0, 1],
[Direction.East]: [1, 0]
}
export const Left = {
[Direction.North]: Direction.West,
[Direction.West]: Direction.South,
[Direction.South]: Direction.East,
[Direction.East]: Direction.North
}
export const Right = {
[Direction.North]: Direction.East,
[Direction.East]: Direction.South,
[Direction.South]: Direction.West,
[Direction.West]: Direction.North
}
// tipagem do estado
interface State {
commands: string | string[]
execute: boolean
facing: string
ghost: boolean
position: string
startPosition: string
endPosition: string
path: { [key: string]: string }
error: null | boolean
start: null | Date
end: null | Date
}
// tipagem do plateau
interface Grid {
size: number
}
// tipagem do contexto
interface Context {
state: State
state2: State
grid: Grid
setState: (state: State) => void
setState2: (state: State) => void
setGrid: (grid: Grid) => void
prevState: () => void
prevState2: () => void
}
export type { State, Context }