{"record":{"id":"fe66bf4581a1977f","repo":"swc-project/swc","slug":"illegal-conversion-cannot-convert-to-identif","errorCode":null,"errorMessage":"illegal conversion: Cannot convert {:?} to Identifier","messagePattern":"illegal conversion: Cannot convert (.+?) to Identifier","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_estree_compat/src/babelify/typescript.rs","lineNumber":108,"sourceCode":"        }\n    }\n}\n\nimpl From<TsFnParamOutput> for IdOrRest {\n    fn from(o: TsFnParamOutput) -> Self {\n        match o {\n            TsFnParamOutput::Id(i) => IdOrRest::Id(i),\n            TsFnParamOutput::Rest(r) => IdOrRest::Rest(r),\n            _ => panic!(\"illegal conversion: Cannot convert {:?} to IdOrRest\", &o),\n        }\n    }\n}\n\nimpl From<TsFnParamOutput> for Identifier {\n    fn from(o: TsFnParamOutput) -> Self {\n        match o {\n            TsFnParamOutput::Id(i) => i,\n            _ => panic!(\"illegal conversion: Cannot convert {:?} to Identifier\", &o),\n        }\n    }\n}\n\nimpl Babelify for TsTypeParamDecl {\n    type Output = TSTypeParameterDeclaration;\n\n    fn babelify(self, ctx: &Context) -> Self::Output {\n        TSTypeParameterDeclaration {\n            base: ctx.base(self.span),\n            params: self.params.babelify(ctx),\n        }\n    }\n}\n\nimpl Babelify for TsTypeParam {\n    type Output = TSTypeParameter;\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_estree_compat/src/babelify/typescript.rs#L90-L126","documentation":"Raised by `From<TsFnParamOutput> for Identifier`, which unwraps the single Id variant into a bare Identifier. The panic fires whenever the converted function parameter is a Rest, Array, or Object variant, because only a plain identifier parameter can be represented as an Identifier. It indicates upstream code assumed a parameter was a simple binding when it was actually a rest or destructuring pattern.","triggerScenarios":"Thrown at crates/swc_estree_compat/src/babelify/typescript.rs:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Match on TsFnParamOutput::Id explicitly at the call site instead of blindly using .into(), and handle the other variants","Validate that the original TsFnParam is TsFnParam::Ident before performing the conversion","If rest parameters can legitimately appear, use the IdOrRest conversion instead which accepts one more variant"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}