{"record":{"id":"0f5e174162998e02","repo":"swc-project/swc","slug":"swc-does-not-support-tuple-expressions","errorCode":null,"errorMessage":"swc does not support tuple expressions","messagePattern":"swc does not support tuple expressions","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_estree_compat/src/swcify/expr.rs","lineNumber":1138,"sourceCode":"\n    fn swcify(self, _: &Context) -> Self::Output {\n        panic!(\"swc does not support `PipelinePrimaryTopicReference`\")\n    }\n}\n\nimpl Swcify for RecordExpression {\n    type Output = Never;\n\n    fn swcify(self, _: &Context) -> Self::Output {\n        panic!(\"swc does not support record expressions\")\n    }\n}\n\nimpl Swcify for TupleExpression {\n    type Output = Never;\n\n    fn swcify(self, _: &Context) -> Self::Output {\n        panic!(\"swc does not support tuple expressions\")\n    }\n}\n\nimpl Swcify for ModuleExpression {\n    type Output = Never;\n\n    fn swcify(self, _: &Context) -> Self::Output {\n        panic!(\"swc does not support module expressions\")\n    }\n}\n\nimpl Swcify for TSAsExpression {\n    type Output = TsAsExpr;\n\n    fn swcify(self, ctx: &Context) -> Self::Output {\n        TsAsExpr {\n            span: ctx.span(&self.base),\n            expr: self.expression.swcify(ctx),","sourceCodeStart":1120,"sourceCodeEnd":1156,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_estree_compat/src/swcify/expr.rs#L1120-L1156","documentation":"Swcify in swc_estree_compat converts swc_estree_ast nodes into swc_ecma_ast nodes. TupleExpression (the `#[1, 2]` literal from the Records & Tuples proposal) does not exist in SWC's AST, so the impl uses `Output = Never` and panics on conversion. SWC cannot express this proposal syntax at all.","triggerScenarios":"Calling `.swcify(ctx)` on an ESTree tree containing a TupleExpression node, produced when source with `#[...]` tuple literals is parsed with @babel/plugin-syntax-record-and-tuple or an equivalent ESTree parser plugin before conversion to SWC.","commonSituations":"Babel-to-SWC interop where proposal syntax was not lowered first; enabling experimental parser plugins in a shared config that also feeds swc_estree_compat; test fixtures containing tuple expressions.","solutions":["Disable the record-and-tuple syntax plugin in the upstream parser so `#[...]` literals never appear","Pre-lower tuples to arrays (or run a babel transform that compiles them) before swcify","Use swc_ecma_parser to parse the original source instead of converting a foreign ESTree AST","Reject input early by scanning the ESTree JSON for `type: \"TupleExpression\"`"],"exampleFix":"// before\nconst pair = #[1, 2];    // babel w/ record-and-tuple syntax\nast.swcify(&ctx);         // panics: swc does not support tuple expressions\n\n// after\nconst pair = [1, 2];     // plain array literal\nast.swcify(&ctx);         // ok","handlingStrategy":"type-guard","validationCode":"let mut bad = Vec::new();\nfind_unsupported(&estree_json, &mut bad); // same walk as error 200\nif bad.iter().any(|t| t == \"TupleExpression\") {\n    return Err(\"tuple literals (#[...]) are not supported by swcify\".into());\n}","typeGuard":"fn is_unsupported_estree_type(t: &str) -> bool {\n    matches!(\n        t,\n        \"TupleExpression\" | \"RecordExpression\" | \"PipelinePrimaryTopicReference\"\n            | \"BindExpression\" | \"DoExpression\" | \"ModuleExpression\"\n    )\n}","tryCatchPattern":"let out = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {\n    estree_expr.swcify(&ctx)\n}));\nif out.is_err() {\n    return Err(\"swcify cannot convert this ESTree tree (tuple/record syntax present)\".into());\n}","preventionTips":["Keep record-and-tuple syntax out of inputs converted via swc_estree_compat","Lower `#[...]` tuples to arrays before conversion","Blocklist-check the ESTree JSON for TupleExpression nodes up front","Parse with SWC's own parser when possible"],"tags":["estree-compat","swcify","ast-conversion","record-tuple-proposal","panic"],"backgroundTag":"unsupported-syntax-feature","analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}