{"record":{"id":"3f3bf78ad197e0cb","repo":"swc-project/swc","slug":"swc-does-not-support-record-expressions","errorCode":null,"errorMessage":"swc does not support record expressions","messagePattern":"swc does not support record expressions","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_estree_compat/src/swcify/expr.rs","lineNumber":1130,"sourceCode":"\n    fn swcify(self, _: &Context) -> Self::Output {\n        panic!(\"swc does not support do expressions\")\n    }\n}\n\nimpl Swcify for PipelinePrimaryTopicReference {\n    type Output = Never;\n\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}","sourceCodeStart":1112,"sourceCodeEnd":1148,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_estree_compat/src/swcify/expr.rs#L1112-L1148","documentation":"Swcify in swc_estree_compat maps each swc_estree_ast node to an swc_ecma_ast node. RecordExpression (the `{| a: 1 |}` literal from the Records & Tuples proposal) has no counterpart in SWC's AST, so its impl returns the uninhabited Never type and panics. This is an intentional hard failure marking the syntax as unrepresentable.","triggerScenarios":"Calling `.swcify(ctx)` on an ESTree tree containing a RecordExpression node, i.e. code parsed with @babel/plugin-syntax-record-and-tuple (or an equivalent parser plugin) producing `{| key: value |}` literals that are then converted to SWC.","commonSituations":"Babel-first pipelines that keep proposal syntax and hand the AST to SWC via swc_estree_compat; mixing parser feature flags (record-and-tuple enabled upstream) with SWC conversion; exploratory tooling that accepts arbitrary ESTree JSON.","solutions":["Remove @babel/plugin-syntax-record-and-tuple (or the parser flag) so `{| |}` record literals are never produced","Lower records to plain object expressions (or esbuild/babel output) before feeding the AST to swcify","Parse the source with swc_ecma_parser, which rejects or handles syntax according to its own feature set","Pre-validate the ESTree JSON for `type: \"RecordExpression\"` nodes and fail with a clear diagnostic instead of panicking"],"exampleFix":"// before\nconst rec = {| a: 1 |};  // parsed by babel w/ record-and-tuple syntax\nast.swcify(&ctx);         // panics: swc does not support record expressions\n\n// after\nconst rec = { a: 1 };    // plain object 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 == \"RecordExpression\") {\n    return Err(\"record literals ({| ... |}) are not supported by swcify\".into());\n}","typeGuard":"fn is_unsupported_estree_type(t: &str) -> bool {\n    matches!(\n        t,\n        \"RecordExpression\" | \"TupleExpression\" | \"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    // map to a diagnostic naming the unsupported node instead of aborting\n    return Err(\"swcify cannot convert this ESTree tree (unsupported proposal syntax)\".into());\n}","preventionTips":["Do not enable record-and-tuple syntax plugins in parsers feeding swc_estree_compat","Convert records to object literals before the AST reaches swcify","Validate incoming ESTree JSON against a blocklist of unsupported node types","Prefer swc_ecma_parser for parsing source directly"],"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-14T00:17:10.932Z"}