Skip to content

Commit 988f61a

Browse files
committed
docs: add more comments
1 parent 5e62e81 commit 988f61a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/apidoc/parameterDefaults.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ interface ParameterDefaultsAware extends Reflection {
2020
implementationDefaultParameters: string[];
2121
}
2222

23+
/**
24+
* TypeDoc EventCallback for EVENT_CREATE_DECLARATION events that reads the default parameters from the implementation.
25+
*/
2326
export const parameterDefaultReader: EventCallback = (
2427
context: Context,
2528
reflection: Reflection
@@ -41,10 +44,17 @@ export const parameterDefaultReader: EventCallback = (
4144
}
4245
};
4346

47+
/**
48+
* Removes removes compile expressions that don't add any value for readers.
49+
*
50+
* @param value The default value to clean.
51+
* @returns The cleaned default value.
52+
*/
4453
function cleanParameterDefault(value?: string): string {
4554
if (value == null) {
4655
return undefined;
4756
}
57+
// Strip type casts: "'foobar' as unknown as T" => "'foobar'"
4858
return value.replace(/ as unknown as [A-Za-z<>]+/, '');
4959
}
5060

0 commit comments

Comments
 (0)