Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dyc3
Copy link
Contributor

@dyc3 dyc3 commented Dec 21, 2025

Summary

The root cause was that during type flattening, when a static member was accessed on a union type eg. node.parentNode (see the snapshot test to get a better idea of what I'm talking about), it would continuously create new types over and over. As a result, it would hit the type limit, and emit the diagnostic.

I have no idea if this is the "correct" fix, since I'm not super familiar with this area of the codebase. I used AI quite heavily here to do the initial instrumentation, draft the fix, and write the test.

fixes #8527

Test Plan

I created a test that showed the behavior on main, and then switched to this branch to make sure the snapshot output changed.

Docs

@changeset-bot
Copy link

changeset-bot bot commented Dec 21, 2025

πŸ¦‹ Changeset detected

Latest commit: 32e3fc6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added L-JavaScript Language: JavaScript and super languages A-Type-Inference Area: type inference labels Dec 21, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 21, 2025

Walkthrough

This patch fixes runaway type growth when resolving static members on union types (issue #8527). Instead of wrapping each union variant in a TypeofExpression, the resolver inspects each variant directly, locates the named member or string index-signature, collects the member’s dereferenced TypeReference per variant, and constructs the resulting union from those references. A test was added that asserts inference of a static member access on a Node | null union to prevent excessive type expansion during repeated property-access patterns.

Suggested reviewers

  • arendjr
  • ematipico

Pre-merge checks and finishing touches

βœ… Passed checks (4 passed)
Check name Status Explanation
Title check βœ… Passed The title clearly and specifically describes the main change: reducing type creation when flattening static member access on union types, which directly addresses the root cause identified in issue #8527.
Description check βœ… Passed The description is well-related to the changeset, explaining the motivation (preventing runaway type creation), disclosing AI assistance, linking to the relevant issue, and documenting the test approach.
Linked Issues check βœ… Passed The PR directly addresses issue #8527 by fixing the root cause of runaway type creation during static member flattening on union types, implementing the fix, and adding a test that reproduces and verifies the corrected behaviour.
Out of Scope Changes check βœ… Passed All changes are scoped to fixing the type flattening issue: the changeset documents the fix, the implementation refactors union member resolution to avoid wrapper construction, and the test verifies the specific problem case.
✨ Finishing touches
  • πŸ“ Generate docstrings
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/fix-assignment-type-runaway

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
crates/biome_js_type_info/src/flattening/expressions.rs (1)

267-293: Solid fix for the runaway type growth issue.

The approach of directly resolving each variant and collecting member references is the right call β€” it avoids the exponential wrapper growth that plagued the previous implementation. Per the retrieved learnings, flattened_union_variants() already returns TypeReference instances with correct module IDs, so using them directly is appropriate.

One optional simplification: the TypeData::Reference wrapper on line 284-286 adds an indirection level. Since member.deref_ty(resolver) already yields a TypeReference, you could push it directly:

πŸ”Ž Optional simplification
                            if let Some(member) = member_opt {
-                                let type_ref = resolver.reference_to_owned_data(
-                                    TypeData::Reference(member.deref_ty(resolver).into_owned()),
-                                );
-                                types.push(type_ref);
+                                types.push(member.deref_ty(resolver).into_owned());
                            }

If the extra storage step is intentional (e.g., to ensure the type is registered in the resolver for later lookups), please disregard β€” the current implementation works correctly either way.

πŸ“œ Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 4e7baf3 and 47989cc.

β›” Files ignored due to path filters (1)
  • crates/biome_js_type_info/tests/snapshots/infer_flattened_type_of_static_member_on_union.snap is excluded by !**/*.snap and included by **
πŸ“’ Files selected for processing (3)
  • .changeset/union-static-member-resolution.md (1 hunks)
  • crates/biome_js_type_info/src/flattening/expressions.rs (2 hunks)
  • crates/biome_js_type_info/tests/flattening.rs (1 hunks)
🧰 Additional context used
πŸ““ Path-based instructions (4)
crates/biome_js_type_info/**/*.rs

πŸ“„ CodeRabbit inference engine (crates/biome_js_type_info/CONTRIBUTING.md)

crates/biome_js_type_info/**/*.rs: No module may copy or clone data from another module in the module graph, not even behind an Arc
Use TypeReference instead of Arc for types that reference other types to avoid stale cache issues when modules are replaced
Store type data in linear vectors instead of using recursive data structures with Arc for improved data locality and performance
Use TypeReference variants (Qualifier, Resolved, Import, Unknown) to represent different phases of type resolution
Use TypeData::Unknown to indicate when type inference falls short or is not implemented
Distinguish between TypeData::Unknown and TypeData::UnknownKeyword to measure inference effectiveness versus explicit user-provided unknown types
When using ResolvedTypeData, track the ResolverId to ensure subsequent resolver calls use the correct context
Always apply the correct ResolverId when retrieving raw type data from ResolvedTypeData.as_raw_data() to prevent panics during subsequent resolution calls

Files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
crates/biome_js_type_info/**/flattening.rs

πŸ“„ CodeRabbit inference engine (crates/biome_js_type_info/CONTRIBUTING.md)

Implement type flattening to simplify TypeofExpression variants once all component types are resolved

Files:

  • crates/biome_js_type_info/tests/flattening.rs
crates/**/*.rs

πŸ“„ CodeRabbit inference engine (CONTRIBUTING.md)

Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates

Files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
.changeset/*.md

πŸ“„ CodeRabbit inference engine (CONTRIBUTING.md)

Write changesets that are concise (1-3 sentences), user-focused, use past tense for actions taken and present tense for Biome behavior, include code examples for rules, and end sentences with periods

Files:

  • .changeset/union-static-member-resolution.md
🧠 Learnings (14)
πŸ““ Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_node_union!` macro to query multiple node types at once
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved

Applied to files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_node_union!` macro to query multiple node types at once

Applied to files:

  • crates/biome_js_type_info/tests/flattening.rs
πŸ“š Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.

Applied to files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types

Applied to files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented

Applied to files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced

Applied to files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph

Applied to files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes

Applied to files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements

Applied to files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance

Applied to files:

  • crates/biome_js_type_info/tests/flattening.rs
  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-12-12T10:11:05.564Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-12T10:11:05.564Z
Learning: Create a changeset for user-facing bug fixes and features using `just new-changeset`, selecting appropriate packages and change type (`major`, `minor`, or `patch`)

Applied to files:

  • .changeset/union-static-member-resolution.md
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
🧬 Code graph analysis (1)
crates/biome_js_type_info/tests/flattening.rs (3)
crates/biome_js_type_info/tests/utils.rs (3)
  • get_interface_declaration (256-270)
  • get_expression (224-238)
  • assert_type_data_snapshot (22-55)
crates/biome_js_type_info/src/local_inference.rs (1)
  • from_ts_interface_declaration (1216-1242)
crates/biome_js_type_info/src/helpers.rs (1)
  • union_of (268-320)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: End-to-end tests
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test Node.js API
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: autofix
πŸ”‡ Additional comments (3)
crates/biome_js_type_info/src/flattening/expressions.rs (1)

11-11: Good cleanup.

Removing the unused TypeofStaticMemberExpression import aligns with the refactored approach below.

.changeset/union-static-member-resolution.md (1)

1-5: Changeset looks good.

Concise, user-focused, and properly links to the issue. Nice work keeping it clear without being overly technical.

crates/biome_js_type_info/tests/flattening.rs (1)

11-49: Good regression test.

The test directly exercises the problematic code path that caused runaway type growth. The setup mirrors real-world patterns (union with nullable interface, recursive property access) and the snapshot assertion will catch any regressions.

One minor note: the inline comment (lines 13-16) is helpful context β€” future maintainers will thank you.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 21, 2025

CodSpeed Performance Report

Merging #8536 will not alter performance

Comparing dyc3/fix-assignment-type-runaway (32e3fc6) with main (8794883)1

Summary

βœ… 58 untouched
⏩ 95 skipped2

Footnotes

  1. No successful run was found on main (4e7baf3) during the generation of this report, so 8794883 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

  2. 95 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

@dyc3 dyc3 force-pushed the dyc3/fix-assignment-type-runaway branch from 47989cc to 32e3fc6 Compare December 21, 2025 21:47
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
crates/biome_js_type_info/src/flattening/expressions.rs (1)

267-293: Solid fix for the runaway type creation issue.

The approach of resolving each variant directly and collecting member type references is much more efficient than the previous TypeofExpression wrapper approach. The logic correctly handles the edge cases via union_of.

One minor observation on lines 284-286: you're wrapping an already-dereferenced TypeReference in TypeData::Reference(...) before registering it. Consider whether you could push member.deref_ty(resolver).into_owned() directly:

πŸ”Ž Potential simplification
                            if let Some(member) = member_opt {
-                               let type_ref = resolver.reference_to_owned_data(
-                                   TypeData::Reference(member.deref_ty(resolver).into_owned()),
-                               );
+                               let type_ref = member.deref_ty(resolver).into_owned();
                                types.push(type_ref);
                            }

If the reference_to_owned_data call is intentional for module ID normalisation or deduplication, feel free to disregardβ€”just wanted to flag it. Based on coding guidelines, ensure the ResolverId context is correctly tracked when working with ResolvedTypeData.

πŸ“œ Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 47989cc and 32e3fc6.

β›” Files ignored due to path filters (1)
  • crates/biome_js_type_info/tests/snapshots/infer_flattened_type_of_static_member_on_union.snap is excluded by !**/*.snap and included by **
πŸ“’ Files selected for processing (3)
  • .changeset/union-static-member-resolution.md (1 hunks)
  • crates/biome_js_type_info/src/flattening/expressions.rs (2 hunks)
  • crates/biome_js_type_info/tests/flattening.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_js_type_info/tests/flattening.rs
🧰 Additional context used
πŸ““ Path-based instructions (2)
crates/biome_js_type_info/**/*.rs

πŸ“„ CodeRabbit inference engine (crates/biome_js_type_info/CONTRIBUTING.md)

crates/biome_js_type_info/**/*.rs: No module may copy or clone data from another module in the module graph, not even behind an Arc
Use TypeReference instead of Arc for types that reference other types to avoid stale cache issues when modules are replaced
Store type data in linear vectors instead of using recursive data structures with Arc for improved data locality and performance
Use TypeReference variants (Qualifier, Resolved, Import, Unknown) to represent different phases of type resolution
Use TypeData::Unknown to indicate when type inference falls short or is not implemented
Distinguish between TypeData::Unknown and TypeData::UnknownKeyword to measure inference effectiveness versus explicit user-provided unknown types
When using ResolvedTypeData, track the ResolverId to ensure subsequent resolver calls use the correct context
Always apply the correct ResolverId when retrieving raw type data from ResolvedTypeData.as_raw_data() to prevent panics during subsequent resolution calls

Files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
**/*.rs

πŸ“„ CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use the dbg!() macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests

Files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
🧠 Learnings (14)
πŸ““ Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_node_union!` macro to query multiple node types at once
πŸ“š Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_node_union!` macro to query multiple node types at once

Applied to files:

  • .changeset/union-static-member-resolution.md
πŸ“š Learning: 2025-12-21T21:15:03.782Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.782Z
Learning: Changesets should describe user-facing changes only; internal refactoring without behavior changes does not require a changeset

Applied to files:

  • .changeset/union-static-member-resolution.md
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
πŸ“š Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context

Applied to files:

  • crates/biome_js_type_info/src/flattening/expressions.rs
🧬 Code graph analysis (1)
crates/biome_js_type_info/src/flattening/expressions.rs (2)
crates/biome_js_type_info/src/type_data.rs (6)
  • types (659-661)
  • types (1533-1535)
  • new (40-44)
  • new (1457-1461)
  • new (1492-1502)
  • ty (566-571)
crates/biome_js_type_info/src/helpers.rs (1)
  • union_of (268-320)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Check Dependencies
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Documentation
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: autofix
πŸ”‡ Additional comments (2)
.changeset/union-static-member-resolution.md (1)

1-5: LGTM!

Clear, user-facing description that explains the fix without exposing internal implementation details. Correctly references the linked issue.

crates/biome_js_type_info/src/flattening/expressions.rs (1)

10-11: Import cleanup aligns with the fix.

Removing TypeofStaticMemberExpression from imports is consistent with the change to resolve union variants directly rather than wrapping them.

@dyc3 dyc3 merged commit efbfbe2 into main Dec 21, 2025
17 checks passed
@dyc3 dyc3 deleted the dyc3/fix-assignment-type-runaway branch December 21, 2025 22:17
@github-actions github-actions bot mentioned this pull request Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Type-Inference Area: type inference L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› Linting Svelte context module produces "unusually large amount of types" diagnostic since Biome 2.3.7

3 participants