Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Plan: Add TypeScript definitions for bech32.js

  • Create bech32.d.ts file with proper type definitions for:
    • toBech32(prefix, bytes, limit?) function
    • fromBech32(str, limit?) function
    • toBech32m(prefix, bytes, limit?) function
    • fromBech32m(str, limit?) function
    • getPrefix(str, limit?) function
  • Update package.json exports to include types for bech32.js
  • Update package.json files section to include bech32.d.ts
  • Run TypeScript compiler to validate type definitions
  • Run tests to ensure functionality is preserved
  • Improve documentation formatting in bech32.d.ts and README.md
  • Remove unrelated .gitignore change
  • Sync bech32.d.ts with README (BIP links, imports, and use Uint8ArrayBuffer)
  • Remove BIP references from function documentation and sync descriptions to README
Original prompt

This section details on the original issue you should resolve

<issue_title>Types: bech32.js</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix issue with bech32.js type definitions Add TypeScript definitions for bech32.js Jan 22, 2026
Copilot AI requested a review from ChALkeR January 22, 2026 10:48
@ChALkeR ChALkeR changed the title Add TypeScript definitions for bech32.js feat: add TypeScript definitions for bech32.js Jan 22, 2026
.gitignore Outdated
coverage
playground
*.tgz
package-lock.json
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

Copy link
Collaborator

Choose a reason for hiding this comment

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

bech32.d.ts Outdated
Comment on lines 2 to 3
* Implements bech32 and bech32m from [BIP173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)
* and [BIP350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki).
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot

Suggested change
* Implements bech32 and bech32m from [BIP173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)
* and [BIP350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki).
* Implements bech32 and bech32m from
* [BIP173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)
* and [BIP350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki).

And sync that into README

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the formatting in both bech32.d.ts and README.md as suggested. (608f3e8)

Copilot AI and others added 3 commits January 22, 2026 19:38
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
@ChALkeR ChALkeR force-pushed the copilot/resolve-bech32-js-issue branch from 608f3e8 to 548047b Compare January 22, 2026 15:38
.gitignore Outdated
coverage
playground
*.tgz
package-lock.json
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot Remove this unrelated change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the package-lock.json line from .gitignore. (d48657d)

bech32.d.ts Outdated
/** The human-readable prefix */
prefix: string;
/** The decoded bytes */
bytes: Uint8Array;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot Use Uint8ArrayBuffer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed bytes type to Uint8ArrayBuffer. (168d623)

bech32.d.ts Outdated
Comment on lines 3 to 4
* [BIP173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)
* and [BIP350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki).
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot Use the exact links as in README

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use exact BIP links with hyphens and #specification anchors. (168d623)

bech32.d.ts Outdated
* and [BIP350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki).
*
* ```js
* import { fromBech32, toBech32, fromBech32m, toBech32m, getPrefix } from '@exodus/bytes/bech32.js'
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot Use exact imports as in README

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use exact multi-line import format from README. (168d623)

Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
bech32.d.ts Outdated
}

/**
* Encode bytes to a bech32 string (BIP 173)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot

  1. Remove (BIP 173) here and below
  2. Sync these docs into README.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed BIP references from function docs and synced the descriptions to README.md. (2e0c199)

Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Copilot AI requested a review from ChALkeR January 22, 2026 15:52
@ChALkeR ChALkeR marked this pull request as ready for review January 22, 2026 15:54
@ChALkeR ChALkeR requested a review from Copilot January 22, 2026 15:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds TypeScript definitions for the bech32.js module, enabling TypeScript users to have proper type checking and IntelliSense support when working with bech32 and bech32m encoding/decoding functions.

Changes:

  • Added TypeScript definition file (bech32.d.ts) with type definitions for all exported functions
  • Updated package.json to include the type definitions in exports and files
  • Enhanced README.md documentation with clearer function descriptions

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
bech32.d.ts Complete TypeScript definitions for bech32/bech32m encode/decode functions with comprehensive JSDoc documentation
package.json Added bech32.d.ts to files array and exports configuration to properly expose TypeScript types
README.md Improved documentation formatting with clearer descriptions for each function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ChALkeR ChALkeR merged commit 8790664 into main Jan 22, 2026
36 checks passed
@ChALkeR ChALkeR deleted the copilot/resolve-bech32-js-issue branch January 22, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Types: bech32.js

3 participants