Skip to content

Conversation

@arendjr
Copy link
Contributor

@arendjr arendjr commented May 21, 2025

Summary

This introduces the TypeData::Module variant, which I intend to use for declare module statements in .d.ts files.

However, the Module type contains TypeMember, which should now be able to hold arbitrary type definitions. I already felt TypeMember was implemented a bit awkwardly, causing some unnecessary duplication, so I've taken the opportunity to refactor it. Now all type members (whether they be object members, class members, or module members) refer to registered types, which can be of any kind of TypeData.

This means we don't make an explicit distinction between properties and methods anymore, the difference is simply whether the reference points to a function or not. Optionality is also no longer an explicit field; it's simply a matter of the referenced type being a union with undefined.

Another side-effect is that our snapshots now make it easier to inspect inferred method signatures, since they've become an explicit part of the registered types.

Test Plan

Tests are updated.

@arendjr arendjr requested review from a team May 21, 2025 10:23
@github-actions github-actions bot added A-Project Area: project L-JavaScript Language: JavaScript and super languages labels May 21, 2025
@arendjr arendjr moved this to In review in Type Inference May 21, 2025
@arendjr arendjr merged commit 367ee9d into biomejs:main May 21, 2025
11 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Type Inference May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project L-JavaScript Language: JavaScript and super languages

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant