Skip to content

Commit e8e8e8d

Browse files
authored
document why module block is optional (#205)
Co-authored-by: resolritter <[email protected]>
1 parent 595f30e commit e8e8e8d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

common/define-grammar.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ module.exports = function defineGrammar(dialect) {
479479

480480
_module: $ => prec.right(seq(
481481
field('name', choice($.string, $.identifier, $.nested_identifier)),
482+
// On .d.ts files "declare module foo" desugars to "declare module foo {}",
483+
// hence why it is optional here
482484
field('body', optional($.statement_block))
483485
)),
484486

0 commit comments

Comments
 (0)