fix: Emit TypeScript type declarations in published package#198
Merged
AntonioVentilii merged 1 commit intomainfrom Apr 17, 2026
Merged
fix: Emit TypeScript type declarations in published package#198AntonioVentilii merged 1 commit intomainfrom
AntonioVentilii merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to make the published @dfinity/ic-pub-key npm package TypeScript-friendly by ensuring .d.ts declarations are emitted during build and by pointing package entry metadata at the built dist/ artifacts.
Changes:
- Enable TypeScript declaration and declaration map emission in
tsconfig.json. - Fix
package.jsonentrypoints by settingmainto./dist/index.jsand addingtypespointing to./dist/index.d.ts.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tsconfig.json | Enables .d.ts / .d.ts.map emission during tsc builds. |
| package.json | Points runtime entry (main) and TS types entry (types) at dist/ outputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
23e3cd4 to
fb69e69
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Made-with: Cursor
fb69e69 to
fedace0
Compare
fspreiss
approved these changes
Apr 17, 2026
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.
Motivation
The published
@dfinity/ic-pub-keynpm package is missing.d.tstype declaration files, which breaks standard TypeScript imports. This was reported in #197.Changes
tsconfig.json: Added"declaration": trueand"declarationMap": trueso thattscemits.d.ts(and.d.ts.map) files alongside the compiled.jsoutput.tsconfig.json: Added test patterns toexclude(src/**/*.test.ts,src/**/*.tests,src/__tests__) so compiled test files and their declarations are not emitted intodist/.package.json: Fixed the"main"field from"index.js"(non-existent at the root) to"./dist/index.js", and added a"types": "./dist/index.d.ts"field so TypeScript can resolve the package's type declarations.package.json: Added a"files": ["dist"]allowlist so only library artifacts are published.src/index.ts,src/signer/index.ts: Added missing.jsextensions to relative import specifiers, consistent with the rest of the codebase. Under"type": "module", Node's ESM resolver requires explicit extensions.Tests
npm run buildsucceeds and.d.tsfiles are generated indist/.npm test). Vitest uses its own transform and is unaffected by thetsconfig.jsonexclude changes.npm pack --dry-runconfirms the tarball contains only runtime/library artifacts (42 files, down from 196 onmain).Fixes #197