Skip to content

Commit

Permalink
interface
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jul 4, 2024
1 parent 2f0caee commit 9a5d399
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/swc_ecma_parser/src/parser/flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ where
}

/// Ported from `flowParseInterfaceish`
fn consume_flow_interfaceish(&mut self, is_class: bool) -> PResult<()> {
pub(super) fn consume_flow_interfaceish(&mut self, is_class: bool) -> PResult<()> {
eat!(self, "interface");

let _id = self.consume_flow_restricted_ident()?;
Expand Down
6 changes: 6 additions & 0 deletions crates/swc_ecma_parser/src/parser/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ impl<'a, I: Tokens> Parser<I> {
self.parse_ts_interface_decl(start)?,
)));
}

if self.input.syntax().flow() && peeked_is!(self, IdentName) {
expect!(self, "interface");
self.consume_flow_interfaceish(false)?;
return Ok(Stmt::Empty(EmptyStmt { span: DUMMY_SP }));
}
}

tok!("type") => {
Expand Down

0 comments on commit 9a5d399

Please sign in to comment.