File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ interface ParameterDefaultsAware extends Reflection {
20
20
implementationDefaultParameters : string [ ] ;
21
21
}
22
22
23
+ /**
24
+ * TypeDoc EventCallback for EVENT_CREATE_DECLARATION events that reads the default parameters from the implementation.
25
+ */
23
26
export const parameterDefaultReader : EventCallback = (
24
27
context : Context ,
25
28
reflection : Reflection
@@ -41,10 +44,17 @@ export const parameterDefaultReader: EventCallback = (
41
44
}
42
45
} ;
43
46
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
+ */
44
53
function cleanParameterDefault ( value ?: string ) : string {
45
54
if ( value == null ) {
46
55
return undefined ;
47
56
}
57
+ // Strip type casts: "'foobar' as unknown as T" => "'foobar'"
48
58
return value . replace ( / a s u n k n o w n a s [ A - Z a - z < > ] + / , '' ) ;
49
59
}
50
60
You can’t perform that action at this time.
0 commit comments