feat: add TypeScript type definitions for multi-byte.js#31
Conversation
| * @returns A function that decodes bytes to string, with optional streaming support | ||
| */ | ||
| export function createMultibyteDecoder( | ||
| encoding: string, |
There was a problem hiding this comment.
type could be stricter, limited to the actual encodings
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
type could be stricter, limited to the actual encodings
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
6db937c to
2c0d3f4
Compare
| * @param options.mode - Encoding mode (default: 'fatal'). Currently, only 'fatal' mode is supported. | ||
| * @returns A function that encodes string to bytes | ||
| */ | ||
| export function createMultibyteEncoder( |
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
README.md
Outdated
| ```js | ||
| import { createMultibyteDecoder } from '@exodus/bytes/multi-byte.js' | ||
| import { createMultibyteDecoder, createMultibyteEncoder } from '@exodus/bytes/multi-byte.js' | ||
| ``` |
There was a problem hiding this comment.
@copilot Move this under the first sentence, like in d.ts
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
@copilot use the exact wording from README on this line.
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
There was a problem hiding this comment.
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.tswith comprehensive type definitions forcreateMultibyteDecoderandcreateMultibyteEncoderfunctions - Updated
package.jsonto 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.
Plan: Add TypeScript types for multi-byte.js
multi-byte.d.tsfile with type definitions for:createMultibyteDecoder(encoding, loose)functioncreateMultibyteEncoder(encoding, options)functionpackage.jsonexports to include types formulti-byte.jscreateMultibyteEncoderdocumentation to READMEOriginal prompt
multi-byte.js#25💡 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.