Typecheck tests against current types

tsx runs tests without type checking and tsconfig.json covers only src,
so 71 type errors had accumulated unnoticed. tsconfig.tests.json now
checks every test and helper, and npm run typecheck includes it.

Fixtures gain the fields the DTOs have grown since they were written
(manualQuantity, circuit apparent power/cos phi, downstream board loads,
section totals, building, cover and board info fields). Repository
lookups that return "row ?? null" now declare the null in their type,
which their callers already handle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian Appel 2026-10-29 13:17:45 +01:00
parent a8cc7eca5e
commit 7222398628
37 changed files with 166 additions and 56 deletions

View file

@ -12,6 +12,19 @@ export const secondWorksharingId =
export const externalXlsxTestConfiguration: ExternalXlsxTransportConfiguration =
createDefaultExternalXlsxTransportConfiguration();
/**
* Loads workbook bytes for editing in a test. ExcelJS declares its own Buffer
* type, which Node 24's generic Buffer does not satisfy (see loadWorkbook in
* external-xlsx-transport.ts).
*/
export async function loadXlsxWorkbook(bytes: Uint8Array) {
const workbook = new ExcelJS.Workbook();
await workbook.xlsx.load(
Buffer.from(bytes) as unknown as Parameters<typeof workbook.xlsx.load>[0]
);
return workbook;
}
export async function createRevitXlsxFixture(options?: {
duplicateWorksharingId?: boolean;
secondWorksharingId?: string;