|
92 | 92 | </include>
|
93 | 93 | </context> <!-- /_choice-export-assignment -->
|
94 | 94 |
|
| 95 | + <!-- ## Type-only export or export type alias declaration |
| 96 | +
|
| 97 | + type-only export: |
| 98 | + export type { T }; |
| 99 | + export type { T } from './mod'; |
| 100 | +
|
| 101 | + export type alias declaration: |
| 102 | + export type Name = string; |
| 103 | + --> |
| 104 | + |
| 105 | + <context id="_choice-export-type-alias-declaration" style-ref="typescript:type-alias-declaration" end-parent="true"> |
| 106 | + <start>\%{js:before-next-token}</start> |
| 107 | + <end>\%{js:statement-end}</end> |
| 108 | + <include> |
| 109 | + <context ref="js:comments"/> |
| 110 | + <context ref="typescript-js-st:_type-alias-declaration-content"/> |
| 111 | + </include> |
| 112 | + </context> <!-- /_choice-export-type-alias-declaration --> |
| 113 | + |
| 114 | + <context id="_choice-export-type-only-or-type-alias-declaration" end-parent="true"> |
| 115 | + <start>\%{typescript:type-keyword}</start> |
| 116 | + <end>\%{js:before-next-token}</end> |
| 117 | + <include> |
| 118 | + <context sub-pattern="0" where="start" style-ref="typescript:type-keyword"/> |
| 119 | + <context ref="js:comments"/> |
| 120 | + |
| 121 | + <context id="_export-type-only-or-type-alias-declaration-content"> |
| 122 | + <include> |
| 123 | + <context ref="js-mod:_choice-export-named"/> |
| 124 | + <context ref="_choice-export-type-alias-declaration"/> |
| 125 | + </include> |
| 126 | + </context> <!-- /_export-type-only-or-type-alias-declaration-content --> |
| 127 | + |
| 128 | + </include> |
| 129 | + </context> <!-- /_choice-export-type-only-or-type-alias-declaration --> |
| 130 | + |
95 | 131 | <!-- ## Export declaration -->
|
96 | 132 |
|
97 | 133 | <!-- replaces js-mod:_export-declaration-content -->
|
|
105 | 141 | <context ref="_choice-import-default-declaration"/> <!-- for import alias declaration -->
|
106 | 142 | <context ref="typescript-js-st:choice-interface-declaration"/>
|
107 | 143 | <context ref="typescript-js-st:choice-namespace-declaration"/>
|
108 |
| - <context ref="typescript-js-st:choice-type-alias-declaration"/> |
| 144 | + <context ref="_choice-export-type-only-or-type-alias-declaration"/> |
109 | 145 | <context ref="js-mod:_export-declaration-content" original="true"/>
|
110 | 146 | </include>
|
111 | 147 | </context> <!-- /export-declaration-content -->
|
|
187 | 223 | </include>
|
188 | 224 | </context> <!-- /_choice-import-alias-or-require -->
|
189 | 225 |
|
| 226 | + <!-- ## Type-only import |
| 227 | +
|
| 228 | + import type T from './mod'; |
| 229 | + import type { A, B } from './mod'; |
| 230 | + import type * as Types from './mod'; |
| 231 | + --> |
| 232 | + |
| 233 | + <context id="_choice-import-type-only" end-parent="true"> |
| 234 | + <start>\%{typescript:type-keyword}</start> |
| 235 | + <end>\%{js:before-next-token}</end> |
| 236 | + <include> |
| 237 | + <context sub-pattern="0" where="start" style-ref="typescript:type-keyword"/> |
| 238 | + <context ref="js:comments"/> |
| 239 | + |
| 240 | + <context id="_import-type-only-content"> |
| 241 | + <include> |
| 242 | + <context ref="js-mod:_choice-import-named"/> |
| 243 | + <context ref="js-mod:_choice-all-as-namespace"/> |
| 244 | + <context ref="js-mod:_choice-import-default"/> |
| 245 | + </include> |
| 246 | + </context> <!-- _import-type-only-content --> |
| 247 | + |
| 248 | + </include> |
| 249 | + </context> <!-- /_choice-import-type-only --> |
| 250 | + |
190 | 251 | <!-- ## Import default -->
|
191 | 252 |
|
192 | 253 | <!-- replaces js-mod:_import-default-content -->
|
|
219 | 280 | </include>
|
220 | 281 | </context> <!-- /_choice-import-default-declaration -->
|
221 | 282 |
|
| 283 | + <!-- replaces js-mod:_import-declaration-content --> |
| 284 | + <context id="import-declaration-content"> |
| 285 | + <include> |
| 286 | + <context ref="_choice-import-type-only"/> |
| 287 | + <context ref="js-mod:_import-declaration-content" original="true"/> |
| 288 | + </include> |
| 289 | + </context> <!-- /import-declaration-content --> |
| 290 | + |
222 | 291 | </definitions>
|
223 | 292 | </language>
|
0 commit comments