fix: add types field to package.json for TypeScript support#581
Open
zxxj wants to merge 1 commit into
Open
Conversation
The package emits TypeScript declaration files (dist/milvus/index.d.ts) via
`tsc --declaration` during build, but the package.json was missing the
`types` field. As a result, TypeScript editors could not resolve types
when importing from @zilliz/milvus2-sdk-node, even though the runtime
worked correctly.
This adds:
```
"types": "dist/milvus/index.d.ts"
```
Fixes the type resolution path so that `import { MilvusClient } from
"@zilliz/milvus2-sdk-node"` provides full IntelliSense and type-checking
in TypeScript projects.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: zxxj The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @zxxj! It looks like this is your first PR to milvus-io/milvus-sdk-node 🎉 |
Author
|
👋 The CI failure looks unrelated to this PR — it only adds a single
These look like environment / flake issues rather than something this PR could have caused. Could a maintainer with repo admin rights please re-run the failed job? 🙏 |
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.
Problem
The package emits TypeScript declaration files via
tsc --declarationduring build (seedist/milvus/index.d.ts), butpackage.jsonis missing thetypesfield. As a result:@zilliz/milvus2-sdk-nodeimport { MilvusClient, MetricType } from "@zilliz/milvus2-sdk-node"works at runtime but provides no IntelliSense, no auto-completion, no type checkingdeclare moduleshims or patchnode_modulesFix
Add a single line to
package.json:"main": "dist/milvus", + "types": "dist/milvus/index.d.ts", "files": [ "dist" ],dist/milvus/index.d.tsis the entry-point declaration file already produced by the existingbuildscript (tsc --declaration && node build.js), so no source code changes are required.Verification
After this change, in any TypeScript project:
Editors will resolve the types automatically.
Notes
buildscript already produces the referencedindex.d.ts, so this is a metadata-only fix