aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-11-14 17:11:26 +0100
committerGitHub <[email protected]>2023-11-14 16:11:26 +0000
commit7e3c92e802614ae5e9f621d9e679dfd6f6d63cf1 (patch)
treebb6813a857c0c42ba1049be5035fce7f45b99c46 /scripts
parent36fc517d17591c8ea1d5135d9a93c7591e3d1f74 (diff)
downloadfaker-7e3c92e802614ae5e9f621d9e679dfd6f6d63cf1.tar.xz
faker-7e3c92e802614ae5e9f621d9e679dfd6f6d63cf1.zip
infra: enable strictNullChecks in tsconfig (#2435)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/apidoc/faker-class.ts6
-rw-r--r--scripts/apidoc/signature.ts2
2 files changed, 6 insertions, 2 deletions
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)}`;
}