Skip to content

Commit 8e9dba7

Browse files
authored
Handle from_clause in export type statement (#208)
1 parent f2e2dd6 commit 8e9dba7

File tree

6 files changed

+217784
-217319
lines changed

6 files changed

+217784
-217319
lines changed

common/corpus/types.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,22 @@ Type-only Export
338338
=======================================
339339

340340
export type { UserType }
341+
export type { UserType } from "./User.js";
342+
export type { A, B, C as D } from 'mymodule';
341343

342344
---
343345

344346
(program
345-
(export_statement (export_clause (export_specifier (identifier)))))
347+
(export_statement (export_clause (export_specifier (identifier))))
348+
(export_statement
349+
(export_clause (export_specifier (identifier)))
350+
(string (string_fragment)))
351+
(export_statement
352+
(export_clause
353+
(export_specifier (identifier))
354+
(export_specifier (identifier))
355+
(export_specifier (identifier) (identifier)))
356+
(string (string_fragment))))
346357

347358
=======================================
348359
Flow Export Types

common/define-grammar.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,13 @@ module.exports = function defineGrammar(dialect) {
273273

274274
export_statement: ($, previous) => choice(
275275
previous,
276-
seq('export', 'type', $.export_clause, $._semicolon),
276+
seq(
277+
'export',
278+
'type',
279+
$.export_clause,
280+
optional($._from_clause),
281+
$._semicolon
282+
),
277283
seq('export', '=', $.expression, $._semicolon),
278284
seq('export', 'as', 'namespace', $.identifier, $._semicolon),
279285
),

tsx/src/grammar.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,18 @@
208208
"type": "SYMBOL",
209209
"name": "export_clause"
210210
},
211+
{
212+
"type": "CHOICE",
213+
"members": [
214+
{
215+
"type": "SYMBOL",
216+
"name": "_from_clause"
217+
},
218+
{
219+
"type": "BLANK"
220+
}
221+
]
222+
},
211223
{
212224
"type": "SYMBOL",
213225
"name": "_semicolon"

0 commit comments

Comments
 (0)