aboutsummaryrefslogtreecommitdiff
path: root/scripts/apidoc/parameterDefaults.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/apidoc/parameterDefaults.ts')
-rw-r--r--scripts/apidoc/parameterDefaults.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/apidoc/parameterDefaults.ts b/scripts/apidoc/parameterDefaults.ts
index 243d7e45..b889fe24 100644
--- a/scripts/apidoc/parameterDefaults.ts
+++ b/scripts/apidoc/parameterDefaults.ts
@@ -52,6 +52,7 @@ function cleanParameterDefault(value?: string): string | undefined {
if (value == null) {
return undefined;
}
+
// Strip type casts: "'foobar' as unknown as T" => "'foobar'"
return value.replace(/ as unknown as [A-Za-z<>]+/, '');
}
@@ -124,6 +125,7 @@ function patchSignatureParameterDefaults(
if (signatureParameters.length !== parameterDefaults.length) {
throw new Error('Unexpected parameter length mismatch');
}
+
signatureParameters.forEach(
(param, index) =>
(param.defaultValue = parameterDefaults[index] || param.defaultValue)