diff --git a/crates/oxc_ecmascript/src/constant_evaluation/value_type.rs b/crates/oxc_ecmascript/src/constant_evaluation/value_type.rs index 30613a85565ae..808a68ae3d056 100644 --- a/crates/oxc_ecmascript/src/constant_evaluation/value_type.rs +++ b/crates/oxc_ecmascript/src/constant_evaluation/value_type.rs @@ -61,10 +61,9 @@ impl<'a> From<&Expression<'a>> for ValueType { /// This function ignores the cases that throws an error, e.g. `foo * 0` can throw an error when `foo` is a bigint. /// To detect those cases, use [`crate::side_effects::MayHaveSideEffects::expression_may_have_side_effects`]. fn from(expr: &Expression<'a>) -> Self { - // TODO: complete this match expr { Expression::BigIntLiteral(_) => Self::BigInt, - Expression::BooleanLiteral(_) => Self::Boolean, + Expression::BooleanLiteral(_) | Expression::PrivateInExpression(_) => Self::Boolean, Expression::NullLiteral(_) => Self::Null, Expression::NumericLiteral(_) => Self::Number, Expression::StringLiteral(_) | Expression::TemplateLiteral(_) => Self::String, diff --git a/crates/oxc_minifier/tests/ecmascript/value_type.rs b/crates/oxc_minifier/tests/ecmascript/value_type.rs index 45052b71ce4b3..ff420a8fb485d 100644 --- a/crates/oxc_minifier/tests/ecmascript/value_type.rs +++ b/crates/oxc_minifier/tests/ecmascript/value_type.rs @@ -137,6 +137,7 @@ fn binary_tests() { test("foo <= bar", ValueType::Boolean); test("foo > bar", ValueType::Boolean); test("foo >= bar", ValueType::Boolean); + test("#foo in bar", ValueType::Boolean); } #[test]