🔨 fix typing, add default interop

This commit is contained in:
platane
2020-10-24 00:06:21 +02:00
parent 00e0c54b80
commit 43aa3022af
4 changed files with 33 additions and 16 deletions

View File

@@ -1,6 +1,5 @@
import * as path from "path"; import path from "path";
// @ts-ignore import HtmlWebpackPlugin from "html-webpack-plugin";
import * as HtmlWebpackPlugin from "html-webpack-plugin";
import type { Configuration } from "webpack"; import type { Configuration } from "webpack";

View File

@@ -1,5 +1,5 @@
import * as fs from "fs"; import fs from "fs";
import * as path from "path"; import path from "path";
import { createCanvas } from "canvas"; import { createCanvas } from "canvas";
import { Grid, copyGrid, Color } from "@snk/types/grid"; import { Grid, copyGrid, Color } from "@snk/types/grid";
import { Snake } from "@snk/types/snake"; import { Snake } from "@snk/types/snake";
@@ -9,8 +9,8 @@ import {
getCanvasWorldSize, getCanvasWorldSize,
} from "@snk/draw/drawWorld"; } from "@snk/draw/drawWorld";
import { step } from "@snk/compute/step"; import { step } from "@snk/compute/step";
import * as tmp from "tmp"; import tmp from "tmp";
import * as execa from "execa"; import execa from "execa";
const withTmpDir = async <T>( const withTmpDir = async <T>(
handler: (dir: string) => Promise<T> handler: (dir: string) => Promise<T>

View File

@@ -1,5 +1,4 @@
// @ts-ignore import ParkMiller from "park-miller";
import * as ParkMiller from "park-miller";
import { Color, createEmptyGrid, setColor } from "../grid"; import { Color, createEmptyGrid, setColor } from "../grid";
import { randomlyFillGrid } from "../randomlyFillGrid"; import { randomlyFillGrid } from "../randomlyFillGrid";
@@ -64,14 +63,32 @@ setColor(enclaveK, 3, 5, 3 as Color);
setColor(enclaveK, 1, 5, 3 as Color); setColor(enclaveK, 1, 5, 3 as Color);
setColor(enclaveK, 2, 2, 1 as Color); setColor(enclaveK, 2, 2, 1 as Color);
export const enclaveU = createEmptyGrid(17, 9);
setColor(enclaveU, 1, 1, 3 as Color);
setColor(enclaveU, 2, 1, 3 as Color);
setColor(enclaveU, 3, 1, 3 as Color);
setColor(enclaveU, 0, 1, 3 as Color);
setColor(enclaveU, 0, 2, 3 as Color);
setColor(enclaveU, 0, 3, 3 as Color);
setColor(enclaveU, 3, 1, 3 as Color);
setColor(enclaveU, 3, 2, 3 as Color);
setColor(enclaveU, 3, 3, 3 as Color);
setColor(enclaveU, 1, 4, 3 as Color);
setColor(enclaveU, 3, 4, 3 as Color);
setColor(enclaveU, 3, 5, 3 as Color);
setColor(enclaveU, 1, 5, 3 as Color);
setColor(enclaveU, 2, 2, 1 as Color);
setColor(enclaveU, 1, 2, 1 as Color);
setColor(enclaveU, 2, 3, 1 as Color);
setColor(enclaveU, 1, 3, 1 as Color);
setColor(enclaveU, 2, 4, 1 as Color);
setColor(enclaveU, 16, 8, 1 as Color);
const create = (width: number, height: number, emptyP: number) => { const create = (width: number, height: number, emptyP: number) => {
const grid = createEmptyGrid(width, height); const grid = createEmptyGrid(width, height);
const random = new ParkMiller(10); const pm = new ParkMiller(10);
randomlyFillGrid( const random = pm.integerInRange.bind(pm);
grid, randomlyFillGrid(grid, { colors, emptyP }, random);
{ colors, emptyP },
random.integerInRange.bind(random)
);
return grid; return grid;
}; };

View File

@@ -5,7 +5,8 @@
"skipLibCheck": true, "skipLibCheck": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"forceConsistentCasingInFileNames": true "forceConsistentCasingInFileNames": true,
"esModuleInterop": true
}, },
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }