{"record":{"id":"fae2be4690a4fbb1","repo":"swc-project/swc","slug":"flow-types","errorCode":null,"errorMessage":"flow types","messagePattern":"flow types","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_estree_compat/src/swcify/expr.rs","lineNumber":739,"sourceCode":"    type Output = TaggedTpl;\n\n    fn swcify(self, ctx: &Context) -> Self::Output {\n        TaggedTpl {\n            span: ctx.span(&self.base),\n            tag: self.tag.swcify(ctx),\n            type_params: self.type_parameters.swcify(ctx).map(From::from),\n            tpl: Box::new(self.quasi.swcify(ctx)),\n            ..Default::default()\n        }\n    }\n}\n\nimpl Swcify for TaggedTemplateExprTypeParams {\n    type Output = TsTypeParamInstantiation;\n\n    fn swcify(self, ctx: &Context) -> Self::Output {\n        match self {\n            TaggedTemplateExprTypeParams::Flow(_) => unimplemented!(\"flow types\"),\n            TaggedTemplateExprTypeParams::TS(v) => v.swcify(ctx),\n        }\n    }\n}\n\nimpl Swcify for YieldExpression {\n    type Output = YieldExpr;\n\n    fn swcify(self, ctx: &Context) -> Self::Output {\n        YieldExpr {\n            span: ctx.span(&self.base),\n            arg: self.argument.swcify(ctx),\n            delegate: self.delegate,\n        }\n    }\n}\n\nimpl Swcify for AwaitExpression {","sourceCodeStart":721,"sourceCodeEnd":757,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_estree_compat/src/swcify/expr.rs#L721-L757","documentation":"While converting a Babel/ESTree tagged template expression back to SWC, type parameters can only be TypeScript (mapped to TsTypeParamInstantiation). A Flow-flavored type parameter list (TaggedTemplateExprTypeParams::Flow) has no SWC representation — SWC's AST only models TS type args on tagged templates — so swcify panics with `unimplemented!(\"flow types\")`.","triggerScenarios":"Parsing source with Babel in Flow mode (e.g. `f<T>(\\`...\\`)`-style flow-typed tagged templates) and feeding the resulting AST into swcify instead of using a TypeScript parse.","commonSituations":"Toolchains that reuse a Babel parser configured for Flow (React Native legacy sources) and then try to convert the AST to SWC for further transforms.","solutions":["Parse the source with the TypeScript syntax option (Babel typescript plugin / SWC parser) instead of Flow so type params come out as TS nodes","Strip Flow type annotations with @babel/plugin-transform-flow-strip-types before swcify","Skip Flow-typed nodes explicitly in a pre-conversion visitor"],"exampleFix":"// before\nrequire('@babel/core').parseSync(code, { plugins: ['flow'] });\n\n// after\nrequire('@babel/core').parseSync(code, { plugins: ['typescript'] });","handlingStrategy":"validation","validationCode":"// Node: assert the Babel parse used the TypeScript plugin, not flow\nconst ast = require('@babel/core').parseSync(code, {\n  plugins: [['@babel/plugin-syntax-typescript', { isTSX: true }]],\n});","typeGuard":"function isFlowTypedTaggedTemplate(node) {\n  return node.type === 'TaggedTemplateExpression' && node.typeParameters?.type?.startsWith('Flow');\n}","tryCatchPattern":null,"preventionTips":["Never mix a Flow-mode Babel parser into a pipeline that ends in swcify","Run @babel/plugin-transform-flow-strip-types (or the flow parser's own stripping) before conversion","Add an integration test with a typed tagged template to catch parser-mode regressions"],"tags":["swc","babel","flow","typescript","tagged-template","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"}