diff --git a/checker/src/synthesis/declarations.rs b/checker/src/synthesis/declarations.rs index 771e754f..2745305d 100644 --- a/checker/src/synthesis/declarations.rs +++ b/checker/src/synthesis/declarations.rs @@ -98,6 +98,7 @@ pub(crate) fn synthesise_declaration( | parser::declarations::export::Exportable::Function(_) | parser::declarations::export::Exportable::EnumDeclaration(_) | parser::declarations::export::Exportable::Interface(_) + | parser::declarations::export::Exportable::Namespace(_) | parser::declarations::export::Exportable::TypeAlias(_) => {} } } diff --git a/parser/src/declarations/export.rs b/parser/src/declarations/export.rs index b3a0f813..b453ca48 100644 --- a/parser/src/declarations/export.rs +++ b/parser/src/declarations/export.rs @@ -46,6 +46,8 @@ pub enum Exportable { Interface(InterfaceDeclaration), TypeAlias(TypeAlias), EnumDeclaration(EnumDeclaration), + #[cfg(feature = "full-typescript")] + Namespace(crate::types::namespace::Namespace), Parts(Vec>), ImportAll { r#as: Option, @@ -226,6 +228,14 @@ impl ASTNode for ExportDeclaration { position, }) } else { + #[cfg(feature = "full-typescript")] + if reader.is_keyword("namespace") { + let namespace = crate::types::namespace::Namespace::from_reader(reader)?; + let position = start.union(namespace.get_position()); + + return Ok(Self::Item { exported: Exportable::Namespace(namespace), position }); + } + todo!("{:?}", reader.get_current().get(..20)) // } // Token(TSXToken::Keyword(kw), _) if kw.is_in_function_header() => { @@ -279,6 +289,10 @@ impl ASTNode for ExportDeclaration { Exportable::EnumDeclaration(enum_declaration) => { enum_declaration.to_string_from_buffer(buf, options, local); } + #[cfg(feature = "full-typescript")] + Exportable::Namespace(namespace) => { + namespace.to_string_from_buffer(buf, options, local); + } Exportable::Parts(parts) => { super::import_export_parts_to_string_from_buffer( parts, buf, options, local,