diff --git a/packages/demo/webpack.config.ts b/packages/demo/webpack.config.ts index 2ffe1a8..985f69f 100644 --- a/packages/demo/webpack.config.ts +++ b/packages/demo/webpack.config.ts @@ -1,6 +1,5 @@ -import * as path from "path"; -// @ts-ignore -import * as HtmlWebpackPlugin from "html-webpack-plugin"; +import path from "path"; +import HtmlWebpackPlugin from "html-webpack-plugin"; import type { Configuration } from "webpack"; diff --git a/packages/gif-creator/index.ts b/packages/gif-creator/index.ts index f6854c4..17a0d57 100644 --- a/packages/gif-creator/index.ts +++ b/packages/gif-creator/index.ts @@ -1,5 +1,5 @@ -import * as fs from "fs"; -import * as path from "path"; +import fs from "fs"; +import path from "path"; import { createCanvas } from "canvas"; import { Grid, copyGrid, Color } from "@snk/types/grid"; import { Snake } from "@snk/types/snake"; @@ -9,8 +9,8 @@ import { getCanvasWorldSize, } from "@snk/draw/drawWorld"; import { step } from "@snk/compute/step"; -import * as tmp from "tmp"; -import * as execa from "execa"; +import tmp from "tmp"; +import execa from "execa"; const withTmpDir = async ( handler: (dir: string) => Promise diff --git a/packages/types/__fixtures__/grid.ts b/packages/types/__fixtures__/grid.ts index 72389eb..d9d99cf 100644 --- a/packages/types/__fixtures__/grid.ts +++ b/packages/types/__fixtures__/grid.ts @@ -1,5 +1,4 @@ -// @ts-ignore -import * as ParkMiller from "park-miller"; +import ParkMiller from "park-miller"; import { Color, createEmptyGrid, setColor } from "../grid"; import { randomlyFillGrid } from "../randomlyFillGrid"; @@ -64,14 +63,32 @@ setColor(enclaveK, 3, 5, 3 as Color); setColor(enclaveK, 1, 5, 3 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 grid = createEmptyGrid(width, height); - const random = new ParkMiller(10); - randomlyFillGrid( - grid, - { colors, emptyP }, - random.integerInRange.bind(random) - ); + const pm = new ParkMiller(10); + const random = pm.integerInRange.bind(pm); + randomlyFillGrid(grid, { colors, emptyP }, random); return grid; }; diff --git a/tsconfig.json b/tsconfig.json index a6dc2f0..324cfb4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,8 @@ "skipLibCheck": true, "noUnusedLocals": true, "noUnusedParameters": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true }, "exclude": ["node_modules"] }