swc-project/swc · error
unimplemented
Error message
unimplemented
What it means
An `unimplemented!()` marker inside `Babelify for TsTypeElement` (typescript.rs:216). It fires when a TsTypeElement variant being babelified has no corresponding arm in the match, i.e. that specific TypeScript type member (for example an index signature or a rarely used variant) has not yet been mapped to its ESTree TSTypeElement counterpart. This is a completeness gap in the babelify conversion table, not a user input error.
Solutions
- Identify the exact TsTypeElement variant that reached the unimplemented arm (e.g. by logging it before the panic) and add a babelify arm mapping it to the matching TSTypeElement output
- Update swc_estree_ast to expose the missing node kind if the ESTree side lacks it
- As a stopgap, skip or drop the unsupported member when it cannot affect downstream output, instead of aborting
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/swc_estree_compat/src/babelify/typescript.rs:216 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17).
Data as JSON: /api/errors/91004026c26d38ba.
Report an issue: GitHub.
Appendix: source
Thrown at crates/swc_estree_compat/src/babelify/typescript.rs:216
}
}
}
impl Babelify for TsTypeElement {
type Output = TSTypeElement;
fn babelify(self, ctx: &Context) -> Self::Output {
match self {
TsTypeElement::TsCallSignatureDecl(t) => {
TSTypeElement::CallSignatureDecl(t.babelify(ctx))
}
TsTypeElement::TsConstructSignatureDecl(t) => {
TSTypeElement::ConstructSignatureDecl(t.babelify(ctx))
}
TsTypeElement::TsPropertySignature(t) => TSTypeElement::PropSignature(t.babelify(ctx)),
TsTypeElement::TsMethodSignature(t) => TSTypeElement::MethodSignature(t.babelify(ctx)),
TsTypeElement::TsIndexSignature(t) => TSTypeElement::IndexSignature(t.babelify(ctx)),
TsTypeElement::TsGetterSignature(_) => panic!("unimplemented"),
TsTypeElement::TsSetterSignature(_) => panic!("unimplemented"),
#[cfg(swc_ast_unknown)]
_ => panic!("unable to access unknown nodes"),
}
}
}
impl Babelify for TsCallSignatureDecl {
type Output = TSCallSignatureDeclaration;
fn babelify(self, ctx: &Context) -> Self::Output {
TSCallSignatureDeclaration {
base: ctx.base(self.span),
type_parameters: self.type_params.map(|t| t.babelify(ctx)),
parameters: self
.params
.into_iter()
.map(|param| param.babelify(ctx).into())View on GitHub (pinned to 5176682b65)