Skip to content

Add types for bidi-js#74460

Open
gasp wants to merge 3 commits intoDefinitelyTyped:masterfrom
gasp:add-bidi-js-types
Open

Add types for bidi-js#74460
gasp wants to merge 3 commits intoDefinitelyTyped:masterfrom
gasp:add-bidi-js-types

Conversation

@gasp
Copy link
Contributor

@gasp gasp commented Feb 4, 2026

Summary

Adds TypeScript type definitions for bidi-js, a JavaScript implementation of the Unicode Bidirectional Algorithm.

API:

  • getEmbeddingLevels(string, baseDirection?) - Applies the bidi algorithm
  • getReorderSegments(string, result, start?, end?) - Get segments to reorder
  • getReorderedIndices(string, result, start?, end?) - Get character indices in visual order
  • getReorderedString(string, result, start?, end?) - Get reordered string
  • getBidiCharType(char) / getBidiCharTypeName(char) - Get bidi character type
  • getMirroredCharacter(char) / getMirroredCharactersMap(...) - Get mirrored characters
  • Bracket functions: closingToOpeningBracket, openingToClosingBracket, getCanonicalBracket

Package stats:

  • ~9.8M weekly downloads
  • MIT licensed

Test plan

  • pnpm test bidi-js passes
  • All exported functions are typed

Adds TypeScript type definitions for bidi-js, a JavaScript implementation
of the Unicode Bidirectional Algorithm for handling mixed LTR/RTL text.
@typescript-bot
Copy link
Contributor

typescript-bot commented Feb 4, 2026

@gasp Thank you for submitting this PR!

This is a live comment that I will keep updated.

1 package in this PR

Code Reviews

This PR adds a new definition, so it needs to be reviewed by a DT maintainer before it can be merged.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ❌ Continuous integration tests have failed
  • 🕐 Only a DT maintainer can approve changes when there are new packages added

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 74460,
  "author": "gasp",
  "headCommitOid": "b8ead546feedbfed31b678bb017a8d12bbf8eb1f",
  "mergeBaseOid": "982edf5d9655b7eca3825d113f90ebdbed4aaa39",
  "lastPushDate": "2026-02-04T14:30:18.000Z",
  "lastActivityDate": "2026-02-05T17:50:19.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Well-liked by everyone",
  "pkgInfo": [
    {
      "name": "bidi-js",
      "kind": "add",
      "files": [
        {
          "path": "types/bidi-js/.npmignore",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/bidi-js/bidi-js-tests.ts",
          "kind": "test"
        },
        {
          "path": "types/bidi-js/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/bidi-js/package.json",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/bidi-js/tsconfig.json",
          "kind": "package-meta-ok"
        }
      ],
      "owners": [],
      "addedOwners": [
        "gasp"
      ],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    }
  ],
  "reviews": [
    {
      "type": "stale",
      "reviewer": "sheetalkamat",
      "date": "2026-02-04T22:52:45.000Z",
      "abbrOid": "73e1b76"
    }
  ],
  "mainBotCommentID": 3847805726,
  "ciResult": "fail",
  "ciUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/commit/b8ead546feedbfed31b678bb017a8d12bbf8eb1f/checks?check_suite_id=56531787078"
}

@typescript-bot typescript-bot added the New Definition This PR creates a new definition package. label Feb 4, 2026
@typescript-bot
Copy link
Contributor

🔔 @gasp — you're the only owner, but it would still be good if you find someone to review this PR in the next few days, otherwise a maintainer will look at it. (And if you do find someone, maybe even recruit them to be a second owner to make future changes easier...)

@typescript-bot typescript-bot moved this to Waiting for Code Reviews in Pull Request Status Board Feb 4, 2026
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Action in Pull Request Status Board Feb 4, 2026
* @param char - A bracket character
* @returns The canonical form, or null if not a bracket
*/
export function getCanonicalBracket(char: string): string | null;
Copy link
Contributor

Choose a reason for hiding this comment

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

The usage shows that library exports factory which on invocation gives the object with all these methods
https://www.npmjs.com/package/bidi-js

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Feb 4, 2026
@typescript-bot
Copy link
Contributor

@gasp One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you!

@typescript-bot typescript-bot moved this from Needs Maintainer Action to Needs Author Action in Pull Request Status Board Feb 4, 2026
@typescript-bot typescript-bot added Where is GH Actions? GH Actions didn't give a response to this PR and removed Revision needed This PR needs code changes before it can be merged. labels Feb 5, 2026
@typescript-bot typescript-bot moved this from Needs Author Action to Other in Pull Request Status Board Feb 5, 2026
@gasp
Copy link
Contributor Author

gasp commented Feb 5, 2026

thanks for the review! Indeed, I missed this factory implementation (it's like express). I added it and tested more, it should be ok now

@gasp gasp requested a review from sheetalkamat February 5, 2026 17:30
@typescript-bot typescript-bot removed the Where is GH Actions? GH Actions didn't give a response to this PR label Feb 5, 2026
@typescript-bot typescript-bot moved this from Other to Waiting for Code Reviews in Pull Request Status Board Feb 5, 2026
@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Feb 5, 2026
@typescript-bot
Copy link
Contributor

@gasp The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

Note: builds that are failing do not end up on the list of PRs for the DT maintainers to review.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in Pull Request Status Board Feb 5, 2026
@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Feb 5, 2026
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in Pull Request Status Board Feb 5, 2026
@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Feb 5, 2026
@typescript-bot
Copy link
Contributor

@gasp The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

Note: builds that are failing do not end up on the list of PRs for the DT maintainers to review.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in Pull Request Status Board Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Definition This PR creates a new definition package. The CI failed When GH Actions fails

Projects

Status: Needs Author Action

Development

Successfully merging this pull request may close these issues.

3 participants