diff --git a/crates/oxc_linter/src/rules/unicorn/no_useless_spread/const_eval.rs b/crates/oxc_linter/src/rules/unicorn/no_useless_spread/const_eval.rs index 952bab7a9753c..76661b7ad94e4 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_useless_spread/const_eval.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_useless_spread/const_eval.rs @@ -89,7 +89,7 @@ impl ConstEval for Argument<'_> { impl ConstEval for NewExpression<'_> { fn const_eval(&self) -> ValueHint { - if is_new_array(self) || is_new_typed_array(self) { + if is_new_array(self) { ValueHint::NewArray } else if is_new_map_or_set(self) { ValueHint::NewIterable diff --git a/crates/oxc_linter/src/rules/unicorn/no_useless_spread/mod.rs b/crates/oxc_linter/src/rules/unicorn/no_useless_spread/mod.rs index 3ab38d978f53d..c78b30bcccf91 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_useless_spread/mod.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_useless_spread/mod.rs @@ -594,6 +594,9 @@ fn test() { "[...arr.reduce((set, b) => set.add(b), new Set(iter))]", // NOTE: we may want to consider this a violation in the future "[...(foo ? new Set() : [])]", + // Issue: + "[ ...Uint8Array([ 1, 2, 3 ]) ].map(byte => byte.toString())", + "[ ...new Uint8Array([ 1, 2, 3 ]) ].map(byte => byte.toString())", ]; let fail = vec![