{"record":{"id":"3c17824ffe82af94","repo":"swc-project/swc","slug":"unknown-quote-type-ty","errorCode":null,"errorMessage":"Unknown quote type: {ty:?}","messagePattern":"Unknown quote type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_quote_macros/src/ret_type.rs","lineNumber":54,"sourceCode":"    if let Type::Path(p) = ty {\n        if let Some(ident) = p.path.get_ident() {\n            match &*ident.to_string() {\n                \"Expr\" => return parse(input_str, &mut |p| p.parse_expr().map(|v| *v)),\n                \"Pat\" => return parse(input_str, &mut |p| p.parse_pat()),\n                \"Stmt\" => return parse(input_str, &mut |p| p.parse_stmt_list_item()),\n                \"AssignTarget\" => {\n                    return parse(input_str, &mut |p| {\n                        Ok(AssignTarget::try_from(p.parse_pat()?)\n                            .expect(\"failed to parse AssignTarget\"))\n                    })\n                }\n                \"ModuleItem\" => return parse(input_str, &mut |p| p.parse_module_item()),\n                _ => {}\n            }\n        }\n    }\n\n    bail!(\"Unknown quote type: {ty:?}\");\n}\n\nfn parse<T>(\n    input_str: &str,\n    op: &mut dyn FnMut(&mut Parser<Lexer>) -> PResult<T>,\n) -> Result<BoxWrapper, Error>\nwhere\n    T: ToCode,\n{\n    let cm = Lrc::new(SourceMap::default());\n    let fm = cm.new_source_file(FileName::Anon.into(), input_str.to_string());\n\n    let lexer = Lexer::new(\n        Default::default(),\n        EsVersion::Es2020,\n        StringInput::from(&*fm),\n        None,\n    );","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_quote_macros/src/ret_type.rs#L36-L72","documentation":"swc_ecma_quote_macros' quote! proc macro parses its first argument as a string naming the AST node type to parse the quoted code into (e.g. \"Expr\", \"Stmt\", \"Module\", \"ModuleItem\", \"AssignTarget\"). The macro matches that literal against a fixed list; any string not in the list falls through to bail!('Unknown quote type: {ty:?}'), surfacing as a compile-time macro error.","triggerScenarios":"Writing quote!(\"Param\", \"$p\") or any type name outside the supported set; passing a type alias or newly added swc_ast node name that the macro version does not recognize yet; a typo in the type string, including casing mistakes.","commonSituations":"Upgrading swc_ecma_quote_macros where supported types changed; copy-pasting quote! calls from code targeting a newer/older macro version; using a node type that exists in swc_ecma_ast but was never wired into the quote macro.","solutions":["Use one of the supported type literals for your macro version (Expr, Stmt, Module, ModuleItem, AssignTarget, etc.); check the match statement in ret_type.rs of the version you depend on","For unsupported types, parse into the closest supported type and convert afterwards (e.g. quote to Expr, then convert with TryFrom/TryInto)","Upgrade swc_ecma_quote_macros to a version that supports your type","Verify the type string is spelled and cased exactly as in the supported list"],"exampleFix":"// before\nlet p = quote!(\"Param\", \"$arg: ident\"); // Param not supported\n\n// after: parse as a supported type, then convert\nlet e: Param = quote!(\"Pat\", \"$arg\") .try_into()?; // or use a supported node type directly","handlingStrategy":"validation","validationCode":"// Compile-time: assert the type literal is in the set supported by your macro version.\n// Supported set (check ret_type.rs for your version), e.g.:\nconst SUPPORTED: &[&str] = &[\"Expr\", \"Stmt\", \"Module\", \"ModuleItem\", \"AssignTarget\" /* ... */];\n// const _: () = assert!(SUPPORTED.contains(&\"Expr\")); // Rust has no const str contains; rely on the macro error and fix the literal","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin swc_ecma_quote_macros and swc_ecma_ast to compatible versions in Cargo.toml","Copy quote! type literals from the crate's own tests/examples for your version","Prefer the closest supported node type plus TryInto conversion over wishing for a new literal"],"tags":["quote-macro","proc-macro","compile-time","swc-ast","unsupported-type"],"backgroundTag":"unsupported-macro-type-argument","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"}