Conversation
Adds TypeScript type definitions for bidi-js, a JavaScript implementation of the Unicode Bidirectional Algorithm for handling mixed LTR/RTL text.
|
@gasp Thank you for submitting this PR! This is a live comment that I will keep updated. 1 package in this PRCode ReviewsThis 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
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"
} |
|
🔔 @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...) |
types/bidi-js/index.d.ts
Outdated
| * @param char - A bracket character | ||
| * @returns The canonical form, or null if not a bracket | ||
| */ | ||
| export function getCanonicalBracket(char: string): string | null; |
There was a problem hiding this comment.
The usage shows that library exports factory which on invocation gives the object with all these methods
https://www.npmjs.com/package/bidi-js
|
@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! |
|
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 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. |
|
@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. |
Summary
Adds TypeScript type definitions for bidi-js, a JavaScript implementation of the Unicode Bidirectional Algorithm.
API:
getEmbeddingLevels(string, baseDirection?)- Applies the bidi algorithmgetReorderSegments(string, result, start?, end?)- Get segments to reordergetReorderedIndices(string, result, start?, end?)- Get character indices in visual ordergetReorderedString(string, result, start?, end?)- Get reordered stringgetBidiCharType(char)/getBidiCharTypeName(char)- Get bidi character typegetMirroredCharacter(char)/getMirroredCharactersMap(...)- Get mirrored charactersclosingToOpeningBracket,openingToClosingBracket,getCanonicalBracketPackage stats:
Test plan
pnpm test bidi-jspasses