From ffbd80d30e70496265b7a7e17fcbfabb2385e0d5 Mon Sep 17 00:00:00 2001 From: Inga Date: Wed, 4 Dec 2024 01:29:05 +0000 Subject: [PATCH] added typed-query-selector dev dependency in preparation to templates migration --- README.md | 1 + package-lock.json | 8 ++++++++ package.json | 1 + src/frontend/components/board-game.ts | 5 ++--- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1971f62..22598bd 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,7 @@ Listed in `package.json`, installed with `npm ci`, not vendored. * `typescript-eslint`, for type-aware and type-checked linting. * `copyfiles`, to copy static assets to the `dist` directory so that they can be next to compiled JS for frontend. * `rimraf`, to cleanup `dist` directory before building. +* `typed-query-selector`, because https://github.com/microsoft/TypeScript/issues/29037 is not addressed yet. #### Backend dependencies (runtime) diff --git a/package-lock.json b/package-lock.json index 6cd2cf4..e544cc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "prettier": "^3.3.3", "rimraf": "^6.0.1", "tap": "^21.0.1", + "typed-query-selector": "^2.12.0", "typescript": "^5.7.2", "typescript-eslint": "^8.16.0" } @@ -6973,6 +6974,13 @@ "node": ">= 0.6" } }, + "node_modules/typed-query-selector": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.0.tgz", + "integrity": "sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==", + "dev": true, + "license": "MIT" + }, "node_modules/typescript": { "version": "5.7.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", diff --git a/package.json b/package.json index e946caa..aac6bc3 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "prettier": "^3.3.3", "rimraf": "^6.0.1", "tap": "^21.0.1", + "typed-query-selector": "^2.12.0", "typescript": "^5.7.2", "typescript-eslint": "^8.16.0" }, diff --git a/src/frontend/components/board-game.ts b/src/frontend/components/board-game.ts index 71df33d..18ba3f8 100644 --- a/src/frontend/components/board-game.ts +++ b/src/frontend/components/board-game.ts @@ -1,3 +1,4 @@ +import type {} from "typed-query-selector/strict.d.ts"; import { BoardgameState } from "../../shared/datatypes/boardgame-state.ts"; import { getTargetGameState } from "../../shared/gameplay/boardgame.ts"; import { CurrentOutcome } from "../../shared/datatypes/types.ts"; @@ -46,9 +47,7 @@ export class BoardGameComponent extends HTMLElement { this.classList.toggle(className, shouldEnable); } - this.querySelectorAll("tbody.game-board").forEach((tbodyUntyped) => { - const tbody = tbodyUntyped as HTMLTableSectionElement; - + this.querySelectorAll("tbody.game-board").forEach((tbody) => { while (gameState.rows < tbody.rows.length) { tbody.rows[0]?.remove(); }