{"record":{"id":"0efeddddd6dd0183","repo":"swc-project/swc","slug":"flow","errorCode":null,"errorMessage":"flow","messagePattern":"flow","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_estree_compat/src/swcify/stmt.rs","lineNumber":730,"sourceCode":"    }\n}\n\nimpl Swcify for ImportNamespaceSpecifier {\n    type Output = ImportStarAsSpecifier;\n\n    fn swcify(self, ctx: &Context) -> Self::Output {\n        ImportStarAsSpecifier {\n            span: ctx.span(&self.base),\n            local: self.local.swcify(ctx).into(),\n        }\n    }\n}\n\nimpl Swcify for DeclareClass {\n    type Output = ClassDecl;\n\n    fn swcify(self, _: &Context) -> Self::Output {\n        unimplemented!(\"flow\")\n    }\n}\n\nimpl Swcify for DeclareFunction {\n    type Output = FnDecl;\n\n    fn swcify(self, _: &Context) -> Self::Output {\n        unimplemented!(\"flow\")\n    }\n}\n\nimpl Swcify for DeclareInterface {\n    type Output = TsInterfaceDecl;\n\n    fn swcify(self, _: &Context) -> Self::Output {\n        unimplemented!(\"flow\")\n    }\n}","sourceCodeStart":712,"sourceCodeEnd":748,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_estree_compat/src/swcify/stmt.rs#L712-L748","documentation":"swcify for the estree DeclareClass node (Flow ambient `declare class C { ... }` statements) is declared but unimplemented — it panics with `unimplemented!(\"flow\")`. SWC has no Flow declaration nodes; ambient declarations would need hand-translation into TS declaration syntax, which this crate never implemented.","triggerScenarios":"Converting a Babel AST parsed in Flow mode that contains `declare class Foo { ... }` ambient class declarations (typical in .js.flow library files) via swc_estree_compat's swcify.","commonSituations":"Migrating Flow-typed libraries or React Native 0.x sources to SWC-based pipelines; consuming .flow definition files through Babel interop.","solutions":["Strip Flow declarations before conversion (flow-strip-types drops declare statements in implementation mode)","Filter out DeclareClass nodes in a pre-pass if the declarations are not needed for output","Parse with TypeScript mode if the source is actually TS ambient declarations"],"exampleFix":"// before\ndeclare class Point { x: number; y: number; }\n\n// after (after flow-strip-types with declarations dropped, or hand-translated)\n// (declaration removed from implementation output)","handlingStrategy":"validation","validationCode":"// Node: reject Flow declare nodes before swcify\nconst FLOW_DECLARE = new Set(['DeclareClass','DeclareFunction','DeclareInterface','DeclareModule','DeclareModuleExports','DeclareTypeAlias','DeclareVariable','DeclareExportDeclaration']);\nfunction containsFlowDeclares(node) {\n  return FLOW_DECLARE.has(node.type)\n    || Object.values(node).some(v => v && typeof v === 'object' && containsFlowDeclares(v));\n}","typeGuard":"function isFlowDeclareNode(node) {\n  return node.type.startsWith('Declare');\n}","tryCatchPattern":null,"preventionTips":["Run flow-strip-types before any Babel->SWC conversion","Filter declare* nodes when declarations are irrelevant to emitted code","Never point a swcify pipeline at .js.flow or Flow-parsed sources"],"tags":["swc","babel","flow","declare","ambient","ast-conversion"],"backgroundTag":"unimplemented-ast-node-conversion","analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}