Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces TypeScript-based type-checking for the JavaScript codebase (via JSDoc), adds local .d.ts shims for missing dependency types, and advances the package toward ESM-only support (including packaging/script updates and corresponding test updates).
Changes:
- Added
tsconfig.json/declaration.tsconfig.jsonand npm scripts to runtsctype-safety checks and generate declarations. - Added local type shims under
types/for dependencies lacking suitable declarations. - Updated runtime/library/CLI/test code with stricter JSDoc types and ESM-oriented imports; removed CJS compatibility artifacts/tests.
Reviewed changes
Copilot reviewed 34 out of 47 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| types/which/index.d.ts | Adds local shim typings for which. |
| types/read-package-json-fast/index.d.ts | Adds local shim typings for read-package-json-fast. |
| tsconfig.json | Enables allowJs + checkJs type-checking and configures typeRoots. |
| declaration.tsconfig.json | Adds declaration-only build config for emitting .d.ts files. |
| package.json | Adds types, check:tsc, declaration build/clean scripts, and updates test coverage tooling; sets ESM-only main. |
| .gitignore | Ignores generated declaration outputs under lib/. |
| .knip.jsonc | Updates Knip entrypoints to reflect ESM-only structure. |
| scripts/make-slink.js | Narrows caught error typing before reading err.code. |
| plans/add-full-jsdoc-type-checking.md | Adds detailed plan/notes for the type-checking migration. |
| lib/spawn.js | Adds JSDoc imports/types for spawn wrapper. |
| lib/spawn-win32.js | Adds safer pid handling and JSDoc typing for Win32 spawn/kill. |
| lib/spawn-posix.js | Adds safer pid handling and JSDoc typing for POSIX spawn/kill. |
| lib/run-tasks.js | Tightens result typing, aggregate-output handling, and signal→exit-code mapping. |
| lib/run-task.js | Tightens typing, stream handling, and pnpm detection logic (but contains a runtime ESM bug noted in comments). |
| lib/read-package-json.js | Adds typed return shape for package.json reading helper. |
| lib/npm-run-all-error.js | Makes error message robust to task vs name presence. |
| lib/match-tasks.js | Adds JSDoc typedefs and narrows colon/slash conversion typing. |
| lib/index.js | Adds public API typedefs and refactors promise chain to async flow with stronger typing. |
| lib/create-prefix-transform-stream.js | Adds JSDoc types for state and transform callback. |
| lib/create-header.js | Types packageInfo nullable and avoids missing scripts lookups. |
| lib/cjs.cjs | Removes the CommonJS wrapper entry (ESM-only move). |
| bin/run-s/main.js | Switches to internal ESM import and narrows error handling/types. |
| bin/run-s/help.js | Adds stream typing and returns Promise<null>. |
| bin/run-p/main.js | Switches to internal ESM import and narrows error handling/types. |
| bin/run-p/help.js | Adds stream typing and returns Promise<null>. |
| bin/npm-run-all/main.js | Switches to internal ESM import and narrows error handling/types. |
| bin/npm-run-all/help.js | Adds stream typing and returns Promise<null>. |
| bin/common/version.js | Adds stream typing and returns Promise<null>. |
| bin/common/parse-cli-args.js | Adds precise JSDoc typedefs and improves argument parsing guards. |
| bin/common/bootstrap.js | Adds JSDoc signature for bootstrap function. |
| test/yarn.js | Adds null-guard for cp.stderr when piping. |
| test/sequential.js | Updates imports to local ESM entry and adds stronger assertions/types. |
| test/print-name.js | Updates imports and aligns createHeader call signature. |
| test/print-label.js | Updates imports to local ESM entry. |
| test/pattern.js | Updates imports and tightens assertions/types, including undefined vs null. |
| test/parallel.js | Updates imports to local ESM entry and adds stronger assertions/types. |
| test/package-config.js | Fixes npm major parsing/type safety. |
| test/lib/util.cjs | Narrows caught errors before checking code. |
| test/lib/spawn-with-kill.cjs | Adds JSDoc typing for helper. |
| test/lib/buffer-stream.cjs | Adds @override tag for _write. |
| test/fail.js | Tightens JSDoc types and narrows caught errors before reading .code. |
| test/config.js | Updates imports to local ESM entry. |
| test/common.js | Updates imports to local ESM entry and tightens assertions/types. |
| test/argument-placeholders.js | Updates imports and fixes typing for strictEqual. |
| test/aggregate-output.js | Updates imports and tightens stdout typing/init. |
| test/compatibility.mjs | Removes ESM import-map compatibility test. |
| test/compatibility.cjs | Removes CJS compatibility tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
68c7174 to
730a550
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 51 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
lib/index.js:216
- The public JSDoc for
npmRunAll()declarespatternOrPatternsasstring|string[], but the implementation (viatoArray()) explicitly acceptsnull|undefinedand tests rely onnodeApi(null)as a supported way to do nothing. This mismatch will leak into generated declarations / type checking; update the@paramtype (and, if intended, document the null behavior) so the published types match runtime behavior.
|
Need to make sure the npm tarball has everything it needs in it. Also need to switch to the files glob array in package.json |
|
I will cut the next major release after this lands. |
e2803a4 to
8542825
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Ok looking good to merge. |
Implements full type safety, fixes existing jsdoc types and generally cleans up esm support. Next release will be esm only, and I will not be releasing the cjs support that was never released.