-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add TypeScript definitions for bech32.js #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
.gitignore
Outdated
| coverage | ||
| playground | ||
| *.tgz | ||
| package-lock.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot ^
bech32.d.ts
Outdated
| * 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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * 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
There was a problem hiding this comment.
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)
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
608f3e8 to
548047b
Compare
.gitignore
Outdated
| coverage | ||
| playground | ||
| *.tgz | ||
| package-lock.json |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Use Uint8ArrayBuffer
There was a problem hiding this comment.
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
| * [BIP173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki) | ||
| * and [BIP350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki). |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Remove
(BIP 173)here and below - Sync these docs into README.md
There was a problem hiding this comment.
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>
There was a problem hiding this 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.
Plan: Add TypeScript definitions for bech32.js
bech32.d.tsfile with proper type definitions for:toBech32(prefix, bytes, limit?)functionfromBech32(str, limit?)functiontoBech32m(prefix, bytes, limit?)functionfromBech32m(str, limit?)functiongetPrefix(str, limit?)functionpackage.jsonexports to include types for bech32.jspackage.jsonfiles section to include bech32.d.tsOriginal prompt
bech32.js#28💡 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.