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

Skip to content

Conversation

@arendjr
Copy link
Contributor

@arendjr arendjr commented Jun 30, 2025

Summary

Type inference now recognises index signatures and their accesses when they are being indexed as a string.

Example

type BagOfPromises = {
    // This is an index signature definition. It declares that instances of type
    // `BagOfPromises` can be indexed using arbitrary strings.
    [property: string]: Promise<void>;
};

let bag: BagOfPromises = {};
// Because `bag.iAmAPromise` is equivalent to `bag["iAmAPromise"]`, this is
// considered an access to the string index, and a Promise is expected.
bag.iAmAPromise;

Test Plan

Test cases added.

@arendjr arendjr requested review from a team June 30, 2025 15:04
@arendjr arendjr added the A-Type-Inference Area: type inference label Jun 30, 2025
@changeset-bot
Copy link

changeset-bot bot commented Jun 30, 2025

🦋 Changeset detected

Latest commit: 952a524

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

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

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

@arendjr arendjr changed the base branch from main to next June 30, 2025 15:05
@arendjr arendjr changed the title Index signatures feat(core): implement support for index signatures Jun 30, 2025
@github-actions github-actions bot added A-Project Area: project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Jun 30, 2025
@arendjr
Copy link
Contributor Author

arendjr commented Jul 1, 2025

Putting this back in draft, since there appears to be quite a performance regression.

@arendjr arendjr marked this pull request as draft July 1, 2025 12:10
@arendjr arendjr deleted the branch biomejs:next July 1, 2025 19:33
@arendjr arendjr closed this Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter A-Project Area: project A-Type-Inference Area: type inference L-JavaScript Language: JavaScript and super languages

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant