@@ -62,6 +62,10 @@ export function Type({type}) {
62
62
case 'unknown' :
63
63
case 'never' :
64
64
return < Keyword { ...type } /> ;
65
+ case 'this' :
66
+ return < Keyword { ...type } /> ;
67
+ case 'symbol' :
68
+ return < Symbol { ...type } /> ;
65
69
case 'identifier' :
66
70
return < Identifier { ...type } /> ;
67
71
case 'string' :
@@ -88,6 +92,8 @@ export function Type({type}) {
88
92
return < IntersectionType { ...type } /> ;
89
93
case 'application' :
90
94
return < TypeApplication { ...type } /> ;
95
+ case 'typeOperator' :
96
+ return < TypeOperator { ...type } /> ;
91
97
case 'function' :
92
98
return < FunctionType { ...type } /> ;
93
99
case 'parameter' :
@@ -122,12 +128,24 @@ export function Type({type}) {
122
128
}
123
129
case 'conditional' :
124
130
return < ConditionalType { ...type } /> ;
131
+ case 'indexedAccess' :
132
+ return < IndexedAccess { ...type } /> ;
133
+ case 'keyof' :
134
+ return < Keyof { ...type } /> ;
125
135
default :
126
136
console . log ( 'no render component for TYPE' , type ) ;
127
137
return null ;
128
138
}
129
139
}
130
140
141
+ function TypeOperator ( { operator, value} ) {
142
+ return < span > < span className = "token hljs-literal" > { operator } </ span > { ' ' } < Type type = { value } /> </ span > ;
143
+ }
144
+
145
+ function IndexedAccess ( { objectType, indexType} ) {
146
+ return < span > < Type type = { objectType } /> [< Type type = { indexType } /> ]</ span > ;
147
+ }
148
+
131
149
function StringLiteral ( { value} ) {
132
150
return < span className = "token hljs-string" > { `'${ value . replace ( / ' / , '\\\'' ) } '` } </ span > ;
133
151
}
@@ -140,6 +158,14 @@ function BooleanLiteral({value}) {
140
158
return < span className = "token hljs-literal" > { '' + value } </ span > ;
141
159
}
142
160
161
+ function Symbol ( ) {
162
+ return < span className = "token hljs-literal" > symbol</ span > ;
163
+ }
164
+
165
+ function Keyof ( { keyof} ) {
166
+ return < span > < Keyword type = "keyof" /> { ' ' } < Type type = { keyof } /> </ span > ;
167
+ }
168
+
143
169
function Keyword ( { type} ) {
144
170
let link = getDoc ( type ) ;
145
171
if ( link ) {
@@ -523,21 +549,6 @@ function ObjectType({properties, exact}) {
523
549
let optional = property . optional ;
524
550
let value = property . value ;
525
551
526
- // Special handling for methods
527
- if ( value && value . type === 'function' && ! optional && token === 'method' ) {
528
- return (
529
- < div key = { property . key } style = { { paddingLeft : '1.5em' } } >
530
- < span className = "token hljs-function" > { k } </ span >
531
- < span className = "token punctuation" > (</ span >
532
- < JoinList elements = { value . parameters } joiner = ", " />
533
- < span className = "token punctuation" > )</ span >
534
- < span className = "token punctuation" > { ': ' } </ span >
535
- < Type type = { value . return } />
536
- { i < arr . length - 1 ? ',' : '' }
537
- </ div >
538
- ) ;
539
- }
540
-
541
552
let punc = optional ? '?: ' : ': ' ;
542
553
return (
543
554
< div key = { property . key } style = { { paddingLeft : '1.5em' } } >
0 commit comments