diff --git a/crates/biome_js_type_info/src/format_type_info.rs b/crates/biome_js_type_info/src/format_type_info.rs index c2e8f7471cab..88de813555a2 100644 --- a/crates/biome_js_type_info/src/format_type_info.rs +++ b/crates/biome_js_type_info/src/format_type_info.rs @@ -788,23 +788,50 @@ impl Format for Interface { impl Format for Literal { fn fmt(&self, f: &mut Formatter) -> FormatResult<()> { - write!(f, [&format_args![token("value:"), space()]])?; match self { - Self::BigInt(bigint_text) => write!(f, [text(bigint_text, TextSize::default())]), + Self::BigInt(bigint_text) => write!( + f, + [ + token("bigint:"), + space(), + text(bigint_text, TextSize::default()) + ] + ), Self::Boolean(lit) => write!( f, - [text( - lit.as_bool().to_string().as_str(), - TextSize::default() - )] + [ + token("bool:"), + space(), + text(lit.as_bool().to_string().as_str(), TextSize::default()) + ] ), Self::Number(lit) => { - write!(f, [text(lit.as_str(), TextSize::default())]) + write!( + f, + [ + token("number:"), + space(), + text(lit.as_str(), TextSize::default()) + ] + ) } Self::Object(obj) => write!(f, [&obj]), - Self::RegExp(regexp_text) => write!(f, [text(regexp_text, TextSize::default())]), - Self::String(lit) => write!(f, [text(lit.as_str(), TextSize::default())]), - Self::Template(template_text) => write!(f, [text(template_text, TextSize::default())]), + Self::RegExp(regex) => write!( + f, + [token("regex:"), space(), text(regex, TextSize::default())] + ), + Self::String(lit) => write!( + f, + [ + token("string:"), + space(), + text(lit.as_str(), TextSize::default()) + ] + ), + Self::Template(tmpl) => write!( + f, + [token("string:"), space(), text(tmpl, TextSize::default())] + ), } } } diff --git a/crates/biome_js_type_info/src/globals.rs b/crates/biome_js_type_info/src/globals.rs index d69bf821e0f7..29df93aa8747 100644 --- a/crates/biome_js_type_info/src/globals.rs +++ b/crates/biome_js_type_info/src/globals.rs @@ -1,6 +1,6 @@ //! Hardcoded global definitions. -// FIXME: Implement inference from type definitions. +// FIXME: Implement inference from type definitions: https://github.com/biomejs/biome/issues/5977 use std::{ borrow::Cow, @@ -59,22 +59,25 @@ pub const PROMISE_RACE_ID: TypeId = TypeId::new(22); pub const PROMISE_REJECT_ID: TypeId = TypeId::new(23); pub const PROMISE_RESOLVE_ID: TypeId = TypeId::new(24); pub const PROMISE_TRY_ID: TypeId = TypeId::new(25); -pub const BIGINT_STRING_LITERAL_ID: TypeId = TypeId::new(26); -pub const BOOLEAN_STRING_LITERAL_ID: TypeId = TypeId::new(27); -pub const FUNCTION_STRING_LITERAL_ID: TypeId = TypeId::new(28); -pub const NUMBER_STRING_LITERAL_ID: TypeId = TypeId::new(29); -pub const OBJECT_STRING_LITERAL_ID: TypeId = TypeId::new(30); -pub const STRING_STRING_LITERAL_ID: TypeId = TypeId::new(31); -pub const SYMBOL_STRING_LITERAL_ID: TypeId = TypeId::new(32); -pub const UNDEFINED_STRING_LITERAL_ID: TypeId = TypeId::new(33); -pub const TYPEOF_OPERATOR_RETURN_UNION_ID: TypeId = TypeId::new(34); -pub const T_ID: TypeId = TypeId::new(35); -pub const U_ID: TypeId = TypeId::new(36); -pub const CONDITIONAL_CALLBACK_ID: TypeId = TypeId::new(37); -pub const MAP_CALLBACK_ID: TypeId = TypeId::new(38); -pub const VOID_CALLBACK_ID: TypeId = TypeId::new(39); -pub const FETCH_ID: TypeId = TypeId::new(40); -pub const NUM_PREDEFINED_TYPES: usize = 41; // Must be one more than the highest `TypeId` above. +pub const INSTANCEOF_REGEXP_ID: TypeId = TypeId::new(26); +pub const REGEXP_ID: TypeId = TypeId::new(27); +pub const REGEXP_EXEC_ID: TypeId = TypeId::new(28); +pub const BIGINT_STRING_LITERAL_ID: TypeId = TypeId::new(29); +pub const BOOLEAN_STRING_LITERAL_ID: TypeId = TypeId::new(30); +pub const FUNCTION_STRING_LITERAL_ID: TypeId = TypeId::new(31); +pub const NUMBER_STRING_LITERAL_ID: TypeId = TypeId::new(32); +pub const OBJECT_STRING_LITERAL_ID: TypeId = TypeId::new(33); +pub const STRING_STRING_LITERAL_ID: TypeId = TypeId::new(34); +pub const SYMBOL_STRING_LITERAL_ID: TypeId = TypeId::new(35); +pub const UNDEFINED_STRING_LITERAL_ID: TypeId = TypeId::new(36); +pub const TYPEOF_OPERATOR_RETURN_UNION_ID: TypeId = TypeId::new(37); +pub const T_ID: TypeId = TypeId::new(38); +pub const U_ID: TypeId = TypeId::new(39); +pub const CONDITIONAL_CALLBACK_ID: TypeId = TypeId::new(40); +pub const MAP_CALLBACK_ID: TypeId = TypeId::new(41); +pub const VOID_CALLBACK_ID: TypeId = TypeId::new(42); +pub const FETCH_ID: TypeId = TypeId::new(43); +pub const NUM_PREDEFINED_TYPES: usize = 44; // Must be one more than the highest `TypeId` above. pub const GLOBAL_UNKNOWN_ID: ResolvedTypeId = ResolvedTypeId::new(GLOBAL_LEVEL, UNKNOWN_ID); pub const GLOBAL_UNDEFINED_ID: ResolvedTypeId = ResolvedTypeId::new(GLOBAL_LEVEL, UNDEFINED_ID); @@ -83,6 +86,9 @@ pub const GLOBAL_CONDITIONAL_ID: ResolvedTypeId = ResolvedTypeId::new(GLOBAL_LEV pub const GLOBAL_NUMBER_ID: ResolvedTypeId = ResolvedTypeId::new(GLOBAL_LEVEL, NUMBER_ID); pub const GLOBAL_STRING_ID: ResolvedTypeId = ResolvedTypeId::new(GLOBAL_LEVEL, STRING_ID); pub const GLOBAL_ARRAY_ID: ResolvedTypeId = ResolvedTypeId::new(GLOBAL_LEVEL, ARRAY_ID); +pub const GLOBAL_INSTANCEOF_REGEXP_ID: ResolvedTypeId = + ResolvedTypeId::new(GLOBAL_LEVEL, INSTANCEOF_REGEXP_ID); +pub const GLOBAL_REGEXP_ID: ResolvedTypeId = ResolvedTypeId::new(GLOBAL_LEVEL, REGEXP_ID); pub const GLOBAL_GLOBAL_ID /* :smirk: */: ResolvedTypeId = ResolvedTypeId::new(GLOBAL_LEVEL, GLOBAL_ID); pub const GLOBAL_INSTANCEOF_PROMISE_ID: ResolvedTypeId = ResolvedTypeId::new(GLOBAL_LEVEL, INSTANCEOF_PROMISE_ID); @@ -140,24 +146,27 @@ pub fn global_type_name(id: TypeId) -> &'static str { 23 => "Promise.reject", 24 => "Promise.resolve", 25 => "Promise.try", - 26 => "\"bigint\"", - 27 => "\"boolean\"", - 28 => "\"function\"", - 29 => "\"number\"", - 30 => "\"object\"", - 31 => "\"string\"", - 32 => "\"symbol\"", - 33 => "\"undefined\"", - 34 => { + 26 => "instanceof RegExp", + 27 => "RegExp", + 28 => "RegExp.exec", + 29 => "\"bigint\"", + 30 => "\"boolean\"", + 31 => "\"function\"", + 32 => "\"number\"", + 33 => "\"object\"", + 34 => "\"string\"", + 35 => "\"symbol\"", + 36 => "\"undefined\"", + 37 => { "\"bigint\" | \"boolean\" | \"function\" | \"number\" | \"object\" \ | \"string\" | \"symbol\" | \"undefined\"" } - 35 => "T", - 36 => "U", - 37 => "() => conditional", - 38 => "(item: T) => U", - 39 => "() => void", - 40 => "fetch", + 38 => "T", + 39 => "U", + 40 => "() => conditional", + 41 => "(item: T) => U", + 42 => "() => void", + 43 => "fetch", _ => "inferred type", } } @@ -215,6 +224,16 @@ impl Default for GlobalsResolver { }) }; + let regexp_method_definition = |id: TypeId| { + TypeData::from(Function { + is_async: false, + type_parameters: Default::default(), + name: Some(Text::new_static(global_type_name(id))), + parameters: Default::default(), + return_type: ReturnType::Type(GLOBAL_INSTANCEOF_REGEXP_ID.into()), + }) + }; + let string_literal = |value: &'static str| -> TypeData { TypeData::from(Literal::String(Text::new_static(value).into())) }; @@ -311,6 +330,15 @@ impl Default for GlobalsResolver { promise_method_definition(PROMISE_REJECT_ID), promise_method_definition(PROMISE_RESOLVE_ID), promise_method_definition(PROMISE_TRY_ID), + TypeData::instance_of(TypeReference::from(GLOBAL_REGEXP_ID)), + TypeData::Class(Box::new(Class { + name: Some(Text::new_static("RegExp")), + type_parameters: Box::default(), + extends: None, + implements: [].into(), + members: Box::new([method("exec", REGEXP_EXEC_ID)]), + })), + regexp_method_definition(REGEXP_EXEC_ID), string_literal("bigint"), string_literal("boolean"), string_literal("function"), @@ -454,6 +482,8 @@ impl TypeResolver for GlobalsResolver { Some(GLOBAL_ARRAY_ID) } else if qualifier.is_promise() && !qualifier.has_known_type_parameters() { Some(GLOBAL_PROMISE_ID) + } else if qualifier.is_regex() && !qualifier.has_known_type_parameters() { + Some(GLOBAL_REGEXP_ID) } else if !qualifier.type_only && let Some(ident) = qualifier.path.identifier() { diff --git a/crates/biome_js_type_info/src/type_data.rs b/crates/biome_js_type_info/src/type_data.rs index 321e2b253e04..1ad0c83de14a 100644 --- a/crates/biome_js_type_info/src/type_data.rs +++ b/crates/biome_js_type_info/src/type_data.rs @@ -1402,6 +1402,17 @@ impl TypeReferenceQualifier { self.path.is_identifier("Promise") } + /// Checks whether this type qualifier references the `RegExp` type. + /// + /// This method simply checks whether the reference is for a literal + /// `RegExp`, without considering whether another symbol named `RegExp` is + /// in scope. It can be used _after_ type resolution has failed to find a + /// `RegExp` symbol in scope, but should not be used _instead of_ such type + /// resolution. + pub fn is_regex(&self) -> bool { + self.path.is_identifier("RegExp") + } + pub fn with_excluded_binding_id(mut self, binding_id: BindingId) -> Self { self.excluded_binding_id = Some(binding_id); self diff --git a/crates/biome_js_type_info/tests/local_inference.rs b/crates/biome_js_type_info/tests/local_inference.rs index 77826c3fdc89..64b12f71c90f 100644 --- a/crates/biome_js_type_info/tests/local_inference.rs +++ b/crates/biome_js_type_info/tests/local_inference.rs @@ -34,6 +34,17 @@ fn infer_type_of_object_member_expression() { ); } +#[test] +fn infer_type_of_regex() { + const CODE: &str = r#"/ab+c/"#; + + let root = parse_ts(CODE); + let expr = get_expression(&root); + let mut resolver = GlobalsResolver::default(); + let ty = TypeData::from_any_js_expression(&mut resolver, ScopeId::GLOBAL, &expr); + assert_type_data_snapshot(CODE, &ty, &resolver, "infer_type_of_regex"); +} + #[test] fn infer_type_of_typeof_expression() { const CODE: &str = r#"typeof foo"#; diff --git a/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_from_direct_promise_instance.snap b/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_from_direct_promise_instance.snap index f86fe9296891..5788fbabbac4 100644 --- a/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_from_direct_promise_instance.snap +++ b/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_from_direct_promise_instance.snap @@ -18,7 +18,7 @@ instanceof Promise ## Registered types ``` -Global TypeId(0) => value: value +Global TypeId(0) => string: value Global TypeId(1) => Call unresolved reference "resolve" (scope ID: 0)(Global TypeId(0)) diff --git a/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_from_static_promise_function.snap b/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_from_static_promise_function.snap index fd6e6da48b79..0947300023a2 100644 --- a/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_from_static_promise_function.snap +++ b/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_from_static_promise_function.snap @@ -20,5 +20,5 @@ instanceof Promise ``` Global TypeId(0) => Promise.resolve -Global TypeId(1) => value: value +Global TypeId(1) => string: value ``` diff --git a/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_of_typeof_expression.snap b/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_of_typeof_expression.snap index 8a968f0dad5c..52fee610f643 100644 --- a/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_of_typeof_expression.snap +++ b/crates/biome_js_type_info/tests/snapshots/infer_flattened_type_of_typeof_expression.snap @@ -20,7 +20,7 @@ typeof foo; ## Registered types ``` -Thin TypeId(0) => value: foo +Thin TypeId(0) => string: foo -Global TypeId(0) => value: foo +Global TypeId(0) => string: foo ``` diff --git a/crates/biome_js_type_info/tests/snapshots/infer_resolved_type_from_direct_promise_instance.snap b/crates/biome_js_type_info/tests/snapshots/infer_resolved_type_from_direct_promise_instance.snap index 9a81f8e81e7f..afe7a36bc7b8 100644 --- a/crates/biome_js_type_info/tests/snapshots/infer_resolved_type_from_direct_promise_instance.snap +++ b/crates/biome_js_type_info/tests/snapshots/infer_resolved_type_from_direct_promise_instance.snap @@ -18,7 +18,7 @@ new Promise ## Registered types ``` -Global TypeId(0) => value: value +Global TypeId(0) => string: value Global TypeId(1) => Call unresolved reference "resolve" (scope ID: 0)(Global TypeId(0)) diff --git a/crates/biome_js_type_info/tests/snapshots/infer_resolved_type_from_static_promise_function.snap b/crates/biome_js_type_info/tests/snapshots/infer_resolved_type_from_static_promise_function.snap index 74aa180387db..e6539479de04 100644 --- a/crates/biome_js_type_info/tests/snapshots/infer_resolved_type_from_static_promise_function.snap +++ b/crates/biome_js_type_info/tests/snapshots/infer_resolved_type_from_static_promise_function.snap @@ -20,5 +20,5 @@ Call Global TypeId(0)(Global TypeId(1)) ``` Global TypeId(0) => Promise.resolve -Global TypeId(1) => value: value +Global TypeId(1) => string: value ``` diff --git a/crates/biome_js_type_info/tests/snapshots/infer_type_of_binary_expression_eq.snap b/crates/biome_js_type_info/tests/snapshots/infer_type_of_binary_expression_eq.snap index a88c6cf9dcd3..59aca0f78d21 100644 --- a/crates/biome_js_type_info/tests/snapshots/infer_type_of_binary_expression_eq.snap +++ b/crates/biome_js_type_info/tests/snapshots/infer_type_of_binary_expression_eq.snap @@ -12,12 +12,12 @@ const a = 1 === 1; ## Result ``` -a => value: true +a => bool: true ``` ## Registered types ``` -Global TypeId(0) => value: true +Global TypeId(0) => bool: true ``` diff --git a/crates/biome_js_type_info/tests/snapshots/infer_type_of_binary_expression_ne.snap b/crates/biome_js_type_info/tests/snapshots/infer_type_of_binary_expression_ne.snap index 503c4d1f21d2..85007bcf33d5 100644 --- a/crates/biome_js_type_info/tests/snapshots/infer_type_of_binary_expression_ne.snap +++ b/crates/biome_js_type_info/tests/snapshots/infer_type_of_binary_expression_ne.snap @@ -12,12 +12,12 @@ const a = 0 !== 1; ## Result ``` -a => value: true +a => bool: true ``` ## Registered types ``` -Global TypeId(0) => value: true +Global TypeId(0) => bool: true ``` diff --git a/crates/biome_js_type_info/tests/snapshots/infer_type_of_literal.snap b/crates/biome_js_type_info/tests/snapshots/infer_type_of_literal.snap index 6653a4cb24e0..c0a1a97527d4 100644 --- a/crates/biome_js_type_info/tests/snapshots/infer_type_of_literal.snap +++ b/crates/biome_js_type_info/tests/snapshots/infer_type_of_literal.snap @@ -12,12 +12,12 @@ const a = 123.45; ## Result ``` -a => value: 123.45 +a => number: 123.45 ``` ## Registered types ``` -Global TypeId(0) => value: 123.45 +Global TypeId(0) => number: 123.45 ``` diff --git a/crates/biome_js_type_info/tests/snapshots/infer_type_of_regex.snap b/crates/biome_js_type_info/tests/snapshots/infer_type_of_regex.snap new file mode 100644 index 000000000000..db893ac422b4 --- /dev/null +++ b/crates/biome_js_type_info/tests/snapshots/infer_type_of_regex.snap @@ -0,0 +1,16 @@ +--- +source: crates/biome_js_type_info/tests/utils.rs +expression: content +--- +## Input + +```ts +/ab+c/; + +``` + +## Result + +``` +regex: /ab+c/ +``` diff --git a/crates/biome_js_type_info/tests/snapshots/test_reference_to_falsy_subset_of.snap b/crates/biome_js_type_info/tests/snapshots/test_reference_to_falsy_subset_of.snap index f893788be07e..3265e256dca7 100644 --- a/crates/biome_js_type_info/tests/snapshots/test_reference_to_falsy_subset_of.snap +++ b/crates/biome_js_type_info/tests/snapshots/test_reference_to_falsy_subset_of.snap @@ -24,7 +24,7 @@ Global TypeId(1) => undefined | Global TypeId(0) | number Global TypeId(2) => undefined | Global TypeId(0) | number -Global TypeId(3) => value: 0 +Global TypeId(3) => number: 0 Global TypeId(4) => undefined | Global TypeId(0) | Global TypeId(3) ``` diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_export_type_referencing_imported_type.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_export_type_referencing_imported_type.snap index 638215f6b0c3..a30d23160637 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_export_type_referencing_imported_type.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_export_type_referencing_imported_type.snap @@ -50,7 +50,7 @@ Module TypeId(0) => Promise Module TypeId(1) => Module(0) TypeId(7) -Module TypeId(2) => value: true +Module TypeId(2) => bool: true Module TypeId(3) => Object { prototype: No prototype @@ -114,9 +114,9 @@ BindingId(0) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: true +Module TypeId(0) => bool: true -Module TypeId(1) => value: false +Module TypeId(1) => bool: false Module TypeId(2) => Module(0) TypeId(0) | Module(0) TypeId(1) diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_export_types.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_export_types.snap index fb33b175b956..51332c148f49 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_export_types.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_export_types.snap @@ -73,13 +73,13 @@ BindingId(3) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: 42 +Module TypeId(0) => number: 42 Module TypeId(1) => Module(0) TypeId(0) Module TypeId(2) => number -Module TypeId(3) => value: Life, The Universe, and Everything +Module TypeId(3) => string: Life, The Universe, and Everything Module TypeId(4) => Module(0) TypeId(10) diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_exports.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_exports.snap index 5d643c5d6e81..3b0acefd68b0 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_exports.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_exports.snap @@ -198,7 +198,7 @@ Module TypeId(0) => Object { members: [] } -Module TypeId(1) => value: 1 +Module TypeId(1) => number: 1 Module TypeId(2) => Module(0) TypeId(15) diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_generic_mapped_value.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_generic_mapped_value.snap index dd3becd6b7f9..bc39112e9e84 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_generic_mapped_value.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_generic_mapped_value.snap @@ -24,11 +24,11 @@ Imports { ## Registered types ``` -Module TypeId(0) => value: 1 +Module TypeId(0) => number: 1 -Module TypeId(1) => value: 2 +Module TypeId(1) => number: 2 -Module TypeId(2) => value: 3 +Module TypeId(2) => number: 3 Module TypeId(3) => Tuple( [ @@ -85,11 +85,11 @@ Module TypeId(9) => instanceof Array ## Registered types ``` -Full TypeId(0) => value: 1 +Full TypeId(0) => number: 1 -Full TypeId(1) => value: 2 +Full TypeId(1) => number: 2 -Full TypeId(2) => value: 3 +Full TypeId(2) => number: 3 Full TypeId(3) => Tuple( [ diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_generic_return_value.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_generic_return_value.snap index 2170f6aa51ae..254f62006456 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_generic_return_value.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_generic_return_value.snap @@ -66,7 +66,7 @@ Module TypeId(1) => Promise Module TypeId(2) => Promise.resolve -Module TypeId(3) => value: 1 +Module TypeId(3) => number: 1 Module TypeId(4) => Module(0) TypeId(10) @@ -109,7 +109,7 @@ Full TypeId(1) => Promise Full TypeId(2) => Promise.resolve -Full TypeId(3) => value: 1 +Full TypeId(3) => number: 1 Full TypeId(4) => Module(0) TypeId(10) diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_generic_return_value_with_multiple_modules.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_generic_return_value_with_multiple_modules.snap index 9ddcb404b4e4..06dfdaacdd2a 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_generic_return_value_with_multiple_modules.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_generic_return_value_with_multiple_modules.snap @@ -36,7 +36,7 @@ BindingId(0) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: bar +Module TypeId(0) => string: bar Module TypeId(1) => Object { prototype: No prototype @@ -82,7 +82,7 @@ Imports { ## Registered types ``` -Module TypeId(0) => value: bar +Module TypeId(0) => string: bar Module TypeId(1) => Object { prototype: No prototype @@ -95,7 +95,7 @@ Module TypeId(3) => Module(0) TypeId(2).bar Module TypeId(4) => Import Symbol: foo from "/src/foo.ts" -Module TypeId(5) => value: 1 +Module TypeId(5) => number: 1 Module TypeId(6) => Call Module(0) TypeId(4)(Module(0) TypeId(3)Module(0) TypeId(5)) ``` @@ -167,7 +167,7 @@ Full TypeId(0) => namespace for ModuleId(1) Full TypeId(1) => namespace for ModuleId(2) -Full TypeId(2) => value: bar +Full TypeId(2) => string: bar Full TypeId(3) => Object { prototype: No prototype @@ -183,7 +183,7 @@ Full TypeId(5) => Module(1) TypeId(0) Full TypeId(6) => Module(2) TypeId(3) -Full TypeId(7) => value: 1 +Full TypeId(7) => number: 1 -Full TypeId(8) => value: bar +Full TypeId(8) => string: bar ``` diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_import_as_namespace.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_import_as_namespace.snap index 5d709359750f..ef2c757e3e2d 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_import_as_namespace.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_import_as_namespace.snap @@ -73,7 +73,7 @@ BindingId(0) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: 1 +Module TypeId(0) => number: 1 Module TypeId(1) => sync Function "foo" { accepts: { diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_merged_types.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_merged_types.snap index c6f3cb642e11..262570f9324c 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_merged_types.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_merged_types.snap @@ -62,15 +62,15 @@ BindingId(7) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: 1 +Module TypeId(0) => number: 1 -Module TypeId(1) => value: true +Module TypeId(1) => bool: true -Module TypeId(2) => value: a +Module TypeId(2) => string: a -Module TypeId(3) => value: b +Module TypeId(3) => string: b -Module TypeId(4) => value: c +Module TypeId(4) => string: c Module TypeId(5) => Module(0) TypeId(2) | Module(0) TypeId(3) | Module(0) TypeId(4) diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_multiple_reexports.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_multiple_reexports.snap index 9caf6ec9f8eb..ead9bfb9c374 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_multiple_reexports.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_multiple_reexports.snap @@ -38,7 +38,7 @@ BindingId(0) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: bar +Module TypeId(0) => string: bar Module TypeId(1) => sync Function "bar" { accepts: { @@ -131,7 +131,7 @@ BindingId(0) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: 1 +Module TypeId(0) => number: 1 Module TypeId(1) => sync Function "foo" { accepts: { diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_promise_export.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_promise_export.snap index b11f21c9fa04..e56399b4070b 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_promise_export.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_promise_export.snap @@ -40,7 +40,7 @@ BindingId(1) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: value +Module TypeId(0) => string: value Module TypeId(1) => Module(0) TypeId(3) diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_promise_from_imported_function_returning_imported_promise_type.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_promise_from_imported_function_returning_imported_promise_type.snap index f3d868de4a3b..b32e0eee8dab 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_promise_from_imported_function_returning_imported_promise_type.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_promise_from_imported_function_returning_imported_promise_type.snap @@ -69,9 +69,9 @@ BindingId(0) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: true +Module TypeId(0) => bool: true -Module TypeId(1) => value: false +Module TypeId(1) => bool: false Module TypeId(2) => Module(0) TypeId(0) | Module(0) TypeId(1) @@ -131,7 +131,7 @@ Module TypeId(0) => Promise Module TypeId(1) => Module(0) TypeId(7) -Module TypeId(2) => value: true +Module TypeId(2) => bool: true Module TypeId(3) => Object { prototype: No prototype diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_promise_from_imported_function_returning_reexported_promise_type.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_promise_from_imported_function_returning_reexported_promise_type.snap index 422594dfe971..cbe9ea539729 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_promise_from_imported_function_returning_reexported_promise_type.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_promise_from_imported_function_returning_reexported_promise_type.snap @@ -95,9 +95,9 @@ BindingId(0) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: true +Module TypeId(0) => bool: true -Module TypeId(1) => value: false +Module TypeId(1) => bool: false Module TypeId(2) => Module(0) TypeId(0) | Module(0) TypeId(1) @@ -157,7 +157,7 @@ Module TypeId(0) => Promise Module TypeId(1) => Module(0) TypeId(7) -Module TypeId(2) => value: true +Module TypeId(2) => bool: true Module TypeId(3) => Object { prototype: No prototype diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_recursive_looking_vfile.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_recursive_looking_vfile.snap index d6706aaeafe9..f35dea610eb1 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_recursive_looking_vfile.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_recursive_looking_vfile.snap @@ -338,25 +338,25 @@ Module TypeId(4) => Namespace { ], } -Module TypeId(5) => value: ascii +Module TypeId(5) => string: ascii -Module TypeId(6) => value: utf8 +Module TypeId(6) => string: utf8 -Module TypeId(7) => value: utf-8 +Module TypeId(7) => string: utf-8 -Module TypeId(8) => value: utf16le +Module TypeId(8) => string: utf16le -Module TypeId(9) => value: ucs2 +Module TypeId(9) => string: ucs2 -Module TypeId(10) => value: ucs-2 +Module TypeId(10) => string: ucs-2 -Module TypeId(11) => value: base64 +Module TypeId(11) => string: base64 -Module TypeId(12) => value: latin1 +Module TypeId(12) => string: latin1 -Module TypeId(13) => value: binary +Module TypeId(13) => string: binary -Module TypeId(14) => value: hex +Module TypeId(14) => string: hex Module TypeId(15) => Module(0) TypeId(3) | Module(0) TypeId(37) | Module(0) TypeId(35) diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_single_reexport.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_single_reexport.snap index 592bf344bd65..5fd4bcd90924 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_single_reexport.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_single_reexport.snap @@ -91,7 +91,7 @@ BindingId(0) => JsBindingData { ## Registered types ``` -Module TypeId(0) => value: 1 +Module TypeId(0) => number: 1 Module TypeId(1) => sync Function "foo" { accepts: { diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_property_with_getter.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_property_with_getter.snap index 3b509b2be07c..23c9a3e81d2a 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_property_with_getter.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_property_with_getter.snap @@ -46,7 +46,7 @@ Module TypeId(3) => Module(0) TypeId(2).initialise Module TypeId(4) => Call Module(0) TypeId(3)(No parameters) -Module TypeId(5) => value: foo +Module TypeId(5) => string: foo Module TypeId(6) => Module(0) TypeId(10) diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_assign.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_assign.snap index 30c86a12b6ec..9bcd07788b57 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_assign.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_assign.snap @@ -158,5 +158,5 @@ Module TypeId(21) => Module(0) TypeId(23) Module TypeId(22) => Module(0) TypeId(11) -Module TypeId(23) => value: foo +Module TypeId(23) => string: foo ``` diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_export.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_export.snap index 4ca7aefe2f4b..31551c2de8dc 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_export.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_export.snap @@ -132,7 +132,7 @@ Module TypeId(16) => Module(0) TypeId(18) Module TypeId(17) => Module(0) TypeId(22) -Module TypeId(18) => value: foo +Module TypeId(18) => string: foo Module TypeId(19) => sync Function "fooGetter" { accepts: { diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_plain.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_plain.snap index e7ef686d6a98..8d5558bed11c 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_plain.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_plain.snap @@ -120,7 +120,7 @@ Module TypeId(16) => Module(0) TypeId(18) Module TypeId(17) => Module(0) TypeId(22) -Module TypeId(18) => value: foo +Module TypeId(18) => string: foo Module TypeId(19) => sync Function "fooGetter" { accepts: { diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_wrong_scope.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_wrong_scope.snap index ba516db88874..7e4a7d8ca188 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_wrong_scope.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_class_wrong_scope.snap @@ -71,7 +71,7 @@ Imports { ## Registered types ``` -Module TypeId(0) => value: foo +Module TypeId(0) => string: foo Module TypeId(1) => unknown diff --git a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_object.snap b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_object.snap index 32f2f4ab3af7..0fd8d535820c 100644 --- a/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_object.snap +++ b/crates/biome_module_graph/tests/snapshots/test_resolve_type_of_this_in_object.snap @@ -159,7 +159,7 @@ Module TypeId(18) => Module(0) TypeId(20) Module TypeId(19) => Module(0) TypeId(12) -Module TypeId(20) => value: foo +Module TypeId(20) => string: foo Module TypeId(21) => Module(0) TypeId(23)