Add TypeScript declaration files to bnf package - #101
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add .d.mts files for js package under bnf
Add TypeScript declaration files to bnf package
Dec 12, 2025
hzhangxyz
requested changes
Dec 12, 2025
hzhangxyz
left a comment
Member
There was a problem hiding this comment.
不是要你用ts重写你只需要补充一个d mts就行,然后rollup的时候copy过去,pakcage json里标注一下。
Contributor
Author
好的,已经改成简单的方式了。现在是:
所有测试通过 ✓ Commit: 2d75afc |
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
…plugin Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
hzhangxyz
force-pushed
the
copilot/add-dts-for-js-package
branch
from
December 12, 2025 01:27
2d75afc to
19f14ed
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds TypeScript declaration files to the atsds-bnf npm package to provide type definitions for TypeScript users. The implementation follows the same patterns used in the parent atsds package by using .d.mts extension for ES module type definitions.
Key Changes
- Created a manual TypeScript declaration file (
index.d.mts) with properly typed signatures forparseandunparsefunctions - Configured the build pipeline to copy the declaration file to the distribution folder using
rollup-plugin-copy - Updated package metadata to expose TypeScript types through the
typesfield
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| bnf/atsds_bnf/index.d.mts | New TypeScript declaration file with function signatures and JSDoc comments for parse and unparse functions |
| bnf/rollup.config.mjs | Added rollup-plugin-copy plugin to copy declaration file to dist folder during build |
| bnf/package.json | Added types field, included declaration file in files array, and added rollup-plugin-copy as dev dependency |
| bnf/package-lock.json | Lockfile updates for rollup-plugin-copy and its transitive dependencies |
| bnf/atsds_bnf/.gitignore | Updated to track both index.mjs and index.d.mts files (also corrected index.js → index.mjs) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The atsds-bnf npm package lacked TypeScript type definitions, preventing IntelliSense and type checking in TypeScript projects.
Changes
atsds_bnf/index.d.mtswith proper type signatures forparseandunparsefunctionsrollup-plugin-copyto copy.d.mtsfile todist/during buildtypesfield topackage.jsonpointing todist/index.d.mtsindex.mjsJavaScript implementation without TypeScript conversionResult
TypeScript users now get proper type checking and autocompletion:
The declaration file is maintained manually and copied during build, keeping the implementation simple and straightforward while providing full TypeScript support.
Original prompt
<issue_description></issue_description>
Comments on the Issue (you are @copilot in this section)
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.