From 7e3c92e802614ae5e9f621d9e679dfd6f6d63cf1 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 14 Nov 2023 17:11:26 +0100 Subject: infra: enable strictNullChecks in tsconfig (#2435) --- scripts/apidoc/faker-class.ts | 6 +++++- scripts/apidoc/signature.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/apidoc/faker-class.ts b/scripts/apidoc/faker-class.ts index 6672896c..a9acad3c 100644 --- a/scripts/apidoc/faker-class.ts +++ b/scripts/apidoc/faker-class.ts @@ -28,6 +28,10 @@ export async function processFakerRandomizer( .getChildrenByKind(ReflectionKind.Interface) .find((clazz) => clazz.name === 'Randomizer'); + if (randomizerClass == null) { + throw new Error('Randomizer class not found'); + } + return processClass(randomizerClass); } @@ -63,7 +67,7 @@ async function processClass( function hasConstructor(clazz: DeclarationReflection): boolean { return clazz .getChildrenByKind(ReflectionKind.Constructor) - .some((constructor) => constructor.signatures.length > 0); + .some((constructor) => (constructor.signatures?.length ?? 0) > 0); } async function processConstructor( diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 08fe5896..82d4047e 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -305,7 +305,7 @@ async function signatureTypeToText( await Promise.all( signature.parameters?.map( async (p) => `${p.name}: ${await typeToText(p.type)}` - ) + ) ?? [] ) ).join(', ')}) => ${await typeToText(signature.type)}`; } -- cgit v1.2.3