swc-project/swc · error
swc currently does not support importing typescript module f
Error message
swc currently does not support importing typescript module from babel
What it means
A todo!() stub in `Swcify for TSType` (swcify/typescript.rs:100). Converting Babel's TS types back into swc TypeScript nodes is not implemented in this path — the whole impl is a placeholder that unconditionally panics when any TSType node is swcified. It fires whenever the Babel input contains TypeScript type annotations whose types must be converted back to swc AST, marking a known unimplemented conversion area rather than a bad input.
Source
Thrown at crates/swc_estree_compat/src/swcify/typescript.rs:100
}
}
impl Swcify for TSTypeAnnotation {
type Output = TsTypeAnn;
fn swcify(self, ctx: &Context) -> Self::Output {
TsTypeAnn {
span: ctx.span(&self.base),
type_ann: self.type_annotation.swcify(ctx),
}
}
}
impl Swcify for TSType {
type Output = Box<TsType>;
fn swcify(self, _: &Context) -> Self::Output {
todo!("swc currently does not support importing typescript module from babel")
}
}
impl Swcify for SuperTypeParams {
type Output = TsTypeParamInstantiation;
fn swcify(self, ctx: &Context) -> Self::Output {
match self {
SuperTypeParams::Flow(_) => unimplemented!("flow type"),
SuperTypeParams::TS(v) => v.swcify(ctx),
}
}
}
impl Swcify for Access {
type Output = Accessibility;
fn swcify(self, _: &Context) -> Self::Output {View on GitHub (pinned to 5176682b65)
Solutions
- Avoid the swcify path for TypeScript-heavy Babel ASTs until TSType conversion is implemented
- Contribute the TSType-to-TsType mapping arms to swc_estree_compat
- Strip type annotations before conversion if downstream only needs the JS skeleton
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/swc_estree_compat/src/swcify/typescript.rs:100 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/b28008de635e85ed.
Report an issue: GitHub.