swc-project/swc · error
computed spread property
Error message
computed spread property
What it means
The ES2015 computed-properties transform encounters an object spread element whose key is computed, a combination the pass has no ES5 lowering for, and aborts via unimplemented! inside visit_mut_expr. It means the input uses a spread property with a computed key that this pass cannot transpile, not that the code is invalid JavaScript.
Solutions
- Run the object spread / rest-spread lowering pass before the computed-props pass so this shape never arrives
- Restructure the source to avoid a computed key on a spread property
- Guard the Prop variant in visit_mut_expr and handle the spread case explicitly
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/swc_ecma_compat_es2015/src/computed_props.rs:225 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/a7ba780daf1ba208.
Report an issue: GitHub.
Appendix: source
Thrown at crates/swc_ecma_compat_es2015/src/computed_props.rs:225
}
.into(),
);
continue;
// unimplemented!("getter /setter property")
}
Prop::Method(MethodProp { key, function }) => (
prop_name_to_expr(key, self.c.loose),
FnExpr {
ident: None,
function,
}
.into(),
),
#[cfg(swc_ast_unknown)]
_ => panic!("unable to access unknown nodes"),
},
PropOrSpread::Spread(..) => unimplemented!("computed spread property"),
#[cfg(swc_ast_unknown)]
_ => panic!("unable to access unknown nodes"),
};
if !self.c.loose && props_cnt == 1 {
single_cnt_prop = Some(
CallExpr {
span,
callee: helper!(define_property),
args: vec![exprs.pop().unwrap().as_arg(), key.as_arg(), value.as_arg()],
..Default::default()
}
.into(),
);
break;
}
exprs.push(if self.c.loose {
let left = if is_compute {View on GitHub (pinned to 5176682b65)