Skip to content

fix(types): ship @types/node-forge so consumers' type checks pass - #581

Merged
koral-- merged 1 commit into
masterfrom
fix/types-node-forge
Nov 7, 2026
Merged

koral-- merged 1 commit into
masterfrom
fix/types-node-forge

Conversation

@koral--

@koral-- koral-- commented Nov 7, 2026

Copy link
Copy Markdown
Member

Problem

dist/src/ExtendedPublicKey.d.ts does import { pki } from 'node-forge' (ExtendedPublicKey extends pki.rsa.PublicKey). @types/node-forge was only a dev dependency, so a TypeScript consumer that checks library types (skipLibCheck: false, the default) fails:

node_modules/@devicefarmer/adbkit/dist/src/ExtendedPublicKey.d.ts(1,21): error TS7016: Could not find a declaration file for module 'node-forge'.

Fix

@types/node-forge moves from devDependencies to dependencies, with the same range, and the lockfile is updated. ExtendedPublicKey stays forge's own type rather than a hand-written copy, so code that passes it to node-forge (stf's adbkeyutil, for example) keeps compiling.

Notes:

  • @types/node-forge depends on @types/node: "*". A consumer that doesn't already have @types/node now gets the latest one through it, which is why the lockfile drops dev: true for @types/node and undici-types. The declarations already reference Node's events, net, stream, fs and child_process, so a TS consumer needs Node types anyway.
  • The other external modules in the declarations (@devicefarmer/adbkit-logcat and @devicefarmer/adbkit-monkey) ship their own types. The bluebird error in the issue went away with 4.0.

Fixes #120

Verification

A fresh consumer project: npm i <packed tarball> typescript@~6.0.3 @types/node@22, with strict: true, skipLibCheck: false and module/moduleResolution: nodenext. It imports Adb, ExtendedPublicKey, Parser, Client and DeviceClient from the entry point, plus the three deep imports, and reads k.fingerprint and k.n from an ExtendedPublicKey.

  • master tarball: @types installed: node only. tsc fails with TS7016 for node-forge in ExtendedPublicKey.d.ts, and TS2339 because n doesn't exist on ExtendedPublicKey (the forge base type is lost).
  • this branch's tarball: @types installed: node node-forge. tsc OK.

npm test: 284 passing. npm run lint is clean.

🤖 Generated with Claude Code

ExtendedPublicKey's declaration extends node-forge's pki.rsa.PublicKey,
so every TypeScript consumer that checks library types (skipLibCheck
false, the default) needs node-forge's types. They were only a dev
dependency, and a fresh project failed with TS7016 "Could not find a
declaration file for module 'node-forge'".

@types/node-forge is now a regular dependency. The type stays forge's
own, so code that passes ExtendedPublicKey to forge keeps compiling.

Fixes #120

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Karol Wrótniak <[email protected]>
@koral--
koral-- merged commit 611d92d into master Nov 7, 2026
6 checks passed
@koral--
koral-- deleted the fix/types-node-forge branch November 7, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npm library missing Typescript dependencies

1 participant