{"record":{"id":"38305c659aa554f8","repo":"swc-project/swc","slug":"classmember","errorCode":null,"errorMessage":"ClassMember::{:?}","messagePattern":"ClassMember::(.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_transforms_proposal/src/decorators/mod.rs","lineNumber":557,"sourceCode":"                                                    span: DUMMY_SP,\n                                                    arg: Some(value),\n                                                })],\n                                            }),\n                                            ..Default::default()\n                                        }\n                                        .into(),\n                                    }),\n                                    _ => Prop::KeyValue(KeyValueProp {\n                                        key: PropName::Ident(quote_ident!(\"value\")),\n                                        value: Expr::undefined(DUMMY_SP),\n                                    }),\n                                }))))\n                                .collect(),\n                            }\n                            .as_arg(),\n                        )\n                    }\n                    _ => unimplemented!(\"ClassMember::{:?}\", member,),\n                }\n            })\n            .map(Some)\n            .collect();\n\n        make_decorate_call(\n            class.decorators,\n            iter::once({\n                // function(_initialize) {}\n                Function {\n                    span: DUMMY_SP,\n\n                    params: iter::once(initialize.into())\n                        .chain(super_class_ident.map(Pat::from))\n                        .map(|pat| Param {\n                            span: DUMMY_SP,\n                            decorators: Vec::new(),\n                            pat,","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_transforms_proposal/src/decorators/mod.rs#L539-L575","documentation":"In the non-legacy (2022 proposal) decorator transform, SWC builds per-member descriptor info only for constructors, methods, and class properties (ClassMember::Constructor/Method/ClassProp). Any other class member — static blocks, TS index signatures, private properties with decorators, auto-accessors, empty members — falls into the catch-all and panics with `unimplemented!(\"ClassMember::...\")`.","triggerScenarios":"Compiling with jsc.decorators (legacy false) a class that contains a `static { ... }` block, a TS index signature like `[k: string]: any`, a decorated `#privateField`, or another unsupported member while decorators are enabled for that class.","commonSituations":"Modern TS codebases mixing decorators with static initialization blocks or index signatures; libraries like TypeORM/NestJS entities that add index signatures; enabling the new decorator proposal on code written for legacy decorators.","solutions":["Remove the unsupported member from the decorated class: move static-block init into a static field or the constructor, drop the index signature, or undecorate private fields","Switch to \"legacy\": true decorators, which use a different code path that tolerates these members","Upgrade swc_ecma_transforms_proposal in case the member kind is now handled"],"exampleFix":"// before\n@decorator\nclass C {\n    static { register(C); }\n    [k: string]: any;\n}\n\n// after\n@decorator\nclass C {\n    static _init = register(C);\n}","handlingStrategy":"validation","validationCode":"// TS-side precheck of source about to be compiled with new decorators\nconst UNSUPPORTED = /static\\s*\\{|\\[\\s*\\w+\\s*:\\s*\\w+\\s*\\]|@\\w+\\s+#\\w+/;\nif (decoratorsEnabled && !legacy && UNSUPPORTED.test(src)) {\n  throw new Error('Decorated class contains static block / index signature / decorated private member');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ban static blocks and TS index signatures inside decorated classes when using the 2022 proposal","Codemod legacy-decorator codebases (strip decorated private fields) before switching legacy:false","Keep a fixture corpus of decorated classes in CI to catch transform panics on upgrade"],"tags":["swc","decorators","typescript","class","static-block"],"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-23T08:17:48.524Z"}