refactor: fix ts errors

This commit is contained in:
Azgaar 2022-07-05 22:00:34 +03:00
parent 98ae3292fc
commit 3018d94618
17 changed files with 83 additions and 54 deletions

View file

@ -6,5 +6,7 @@ interface Dict<T> {
[key: string]: T;
}
type IntArray = Uint8Array | Uint16Array | Uint32Array;
type RGB = `rgb(${number}, ${number}, ${number})`;
type Hex = `#${string}`;

18
src/types/grid.d.ts vendored
View file

@ -1,7 +1,21 @@
interface IGrid {
spacing: number;
boundary: TPoints;
points: TPoints;
features: IFeature[];
cells: {
h: TypedArray;
prec: number[];
i: IntArray;
b: IntArray;
c: number[][];
h: IntArray;
t: IntArray;
f: IntArray;
prec: IntArray;
};
}
interface IFeature {
i: number;
land: boolean;
border: boolean;
type: "ocean" | "lake" | "island";
}

20
src/types/pack.d.ts vendored
View file

@ -1,10 +1,20 @@
interface IPack {
vertices: {
p: TPoints;
v: number[][];
c: number[][];
};
cells: {
i: number[];
g: number[];
h: number[];
pop: number[];
burg: number[];
i: IntArray;
p: TPoints;
v: number[][];
c: number[][];
g: IntArray;
h: IntArray;
pop: Float32Array;
burg: IntArray;
area: IntArray;
q: d3.Quadtree<number[]>;
};
states: IState[];
cultures: ICulture[];