diff --git a/crates/oxc_ecmascript/src/constant_evaluation/value_type.rs b/crates/oxc_ecmascript/src/constant_evaluation/value_type.rs index 9ff470aa55e21..bba92892383b0 100644 --- a/crates/oxc_ecmascript/src/constant_evaluation/value_type.rs +++ b/crates/oxc_ecmascript/src/constant_evaluation/value_type.rs @@ -71,7 +71,15 @@ impl<'a> From<&Expression<'a>> for ValueType { Expression::ObjectExpression(_) | Expression::ArrayExpression(_) | Expression::RegExpLiteral(_) - | Expression::FunctionExpression(_) => Self::Object, + | Expression::FunctionExpression(_) + | Expression::ArrowFunctionExpression(_) + | Expression::ClassExpression(_) => Self::Object, + Expression::MetaProperty(meta_prop) => { + match (meta_prop.meta.name.as_str(), meta_prop.property.name.as_str()) { + ("import", "meta") => Self::Object, + _ => Self::Undetermined, + } + } Expression::Identifier(ident) => match ident.name.as_str() { "undefined" => Self::Undefined, "NaN" | "Infinity" => Self::Number, diff --git a/crates/oxc_minifier/tests/ecmascript/value_type.rs b/crates/oxc_minifier/tests/ecmascript/value_type.rs index 25c9716ca56da..cf0ddb880ae0f 100644 --- a/crates/oxc_minifier/tests/ecmascript/value_type.rs +++ b/crates/oxc_minifier/tests/ecmascript/value_type.rs @@ -30,8 +30,10 @@ fn literal_tests() { test("[0]", ValueType::Object); test("/a/", ValueType::Object); test("(function () {})", ValueType::Object); - // test("(() => {})", ValueType::Object); - // test("(class {})", ValueType::Object); + test("(() => {})", ValueType::Object); + test("(class {})", ValueType::Object); + test("import.meta", ValueType::Object); + // NOTE: new.target is undefined or object } #[test]