Skip to content

feat: add TypeScript type definitions for multi-byte.js#31

Merged
ChALkeR merged 7 commits intomainfrom
copilot/fix-multi-byte-js-issues
Jan 22, 2026
Merged

feat: add TypeScript type definitions for multi-byte.js#31
ChALkeR merged 7 commits intomainfrom
copilot/fix-multi-byte-js-issues

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Plan: Add TypeScript types for multi-byte.js

  • Create multi-byte.d.ts file with type definitions for:
    • createMultibyteDecoder(encoding, loose) function
    • createMultibyteEncoder(encoding, options) function
  • Update package.json exports to include types for multi-byte.js
  • Verify types work correctly with TypeScript compiler
  • Improve documentation based on code review feedback
  • Add createMultibyteEncoder documentation to README
  • Reorder README multi-byte section to match d.ts structure
  • Commit changes
Original prompt

This section details on the original issue you should resolve

<issue_title>Types: multi-byte.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 issues in multi-byte.js Add TypeScript type definitions for multi-byte.js Jan 22, 2026
Copilot AI requested a review from ChALkeR January 22, 2026 10:38
@ChALkeR ChALkeR changed the title Add TypeScript type definitions for multi-byte.js feat: add TypeScript type definitions for multi-byte.js Jan 22, 2026
* @returns A function that decodes bytes to string, with optional streaming support
*/
export function createMultibyteDecoder(
encoding: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

type could be stricter, limited to the actual encodings

Copy link
Collaborator

Choose a reason for hiding this comment

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

Those could be runtime-determined so it might end up being too strict
Unlike format which should be static

* @returns A function that encodes string to bytes
*/
export function createMultibyteEncoder(
encoding: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

type could be stricter, limited to the actual encodings

Copilot AI and others added 3 commits January 22, 2026 17:45
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/fix-multi-byte-js-issues branch from 6db937c to 2c0d3f4 Compare January 22, 2026 13:45
* @param options.mode - Encoding mode (default: 'fatal'). Currently, only 'fatal' mode is supported.
* @returns A function that encodes string to bytes
*/
export function createMultibyteEncoder(
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot add this to 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.

Added createMultibyteEncoder documentation to README in commit 838ae38

Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Copilot AI requested a review from ChALkeR January 22, 2026 13:51
README.md Outdated
```js
import { createMultibyteDecoder } from '@exodus/bytes/multi-byte.js'
import { createMultibyteDecoder, createMultibyteEncoder } from '@exodus/bytes/multi-byte.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 Move this under the first sentence, like in d.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reordered the section in commit d47a9de to match the d.ts structure: first sentence, then import statement, then supported encodings list.

* import { createMultibyteDecoder, createMultibyteEncoder } from '@exodus/bytes/multi-byte.js'
* ```
*
* Supports all legacy multi-byte encodings listed in the WHATWG Encoding standard:
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 wording from README on this line.

Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Copilot AI requested a review from ChALkeR January 22, 2026 14:03
@ChALkeR ChALkeR marked this pull request as ready for review January 22, 2026 14:25
@ChALkeR ChALkeR requested a review from Copilot January 22, 2026 14:25
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 type definitions for the multi-byte.js module, enabling better TypeScript support for legacy multi-byte encoding operations.

Changes:

  • Created multi-byte.d.ts with comprehensive type definitions for createMultibyteDecoder and createMultibyteEncoder functions
  • Updated package.json to include the new type definitions in both the files array and exports configuration
  • Enhanced README documentation to include encoder function documentation and clarify streaming decoder behavior

Reviewed changes

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

File Description
multi-byte.d.ts New TypeScript type definitions for multi-byte encoding/decoding functions with detailed JSDoc documentation
package.json Added multi-byte.d.ts to files array and types field in exports configuration
README.md Updated documentation to include createMultibyteEncoder and improved description of streaming behavior

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

@ChALkeR ChALkeR merged commit 7818be1 into main Jan 22, 2026
57 of 62 checks passed
@ChALkeR ChALkeR deleted the copilot/fix-multi-byte-js-issues 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: multi-byte.js

4 participants