@@ -28,31 +28,33 @@ export function memberDeclaration(context: DefaultThemeRenderContext, props: Dec
28
28
}
29
29
30
30
const visitor = { reflection : renderTypeDeclaration } ;
31
-
32
- /** Fix for #2717. If type is the same as value the type is omited */
33
- function shouldRenderType ( ) {
34
- if ( props . type && props . type . type === "literal" ) {
31
+
32
+ /** Fix for #2717. If type is the same as value the type is omited */
33
+ function shouldRenderType ( ) {
34
+ if ( props . type && props . type . type === "literal" ) {
35
35
const typeObject = props . type . toObject ( ) ;
36
36
const value = typeObject . value ;
37
- if ( ! value ) { // should be unreachable
37
+ if ( ! value ) {
38
+ // should be unreachable
38
39
return true ;
39
40
}
40
- if ( typeof value === "object" ) {
41
+ if ( typeof value === "object" ) {
41
42
return true ;
42
43
}
43
44
const reflectionTypeString : string = value . toString ( ) ;
44
45
let defaultValue = props . defaultValue ! ;
45
- if ( defaultValue ) {
46
+ if ( defaultValue ) {
46
47
// If the default value is string and it's wrapped in ' in the code, the value is wrapped in " and vice-versa
47
- if ( ( defaultValue [ 0 ] === '"' && defaultValue [ defaultValue . length - 1 ] === '"' ) ||
48
+ if (
49
+ ( defaultValue [ 0 ] === '"' && defaultValue [ defaultValue . length - 1 ] === '"' ) ||
48
50
( defaultValue [ 0 ] === "'" && defaultValue [ defaultValue . length - 1 ] === "'" )
49
51
) {
50
52
defaultValue = defaultValue . slice ( 1 , - 1 ) ;
51
53
}
52
54
}
53
-
54
- if ( reflectionTypeString === defaultValue . toString ( ) ) {
55
- return false ;
55
+
56
+ if ( reflectionTypeString === defaultValue . toString ( ) ) {
57
+ return false ;
56
58
}
57
59
return true ;
58
60
}
0 commit comments