-
Notifications
You must be signed in to change notification settings - Fork 0
Add TypeScript declaration files to bnf package #101
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
hzhangxyz
left a comment
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.
不是要你用ts重写你只需要补充一个d mts就行,然后rollup的时候copy过去,pakcage json里标注一下。
好的,已经改成简单的方式了。现在是:
所有测试通过 ✓ Commit: 2d75afc |
Co-authored-by: hzhangxyz <[email protected]>
Co-authored-by: hzhangxyz <[email protected]>
…plugin Co-authored-by: hzhangxyz <[email protected]>
2d75afc to
19f14ed
Compare
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 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.
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.