Skip to content

Fix: node command env declaration - #585

Merged
brunomenezes merged 2 commits into
prerelease/v2-alphafrom
fix/node-command-env-declaration
Nov 25, 2026
Merged

brunomenezes merged 2 commits into
prerelease/v2-alphafrom
fix/node-command-env-declaration

Conversation

@brunomenezes

Copy link
Copy Markdown
Member

Summary

A consumer of @cartesi/cli compiling with exactOptionalPropertyTypes: true and skipLibCheck: false fails inside our declarations, on any import from the package:

dist/types/exec/node-container.d.ts: error TS2344: Type '{ env: Record<string, string> | undefined; ... }' does not satisfy the constraint 'Options'.

runNodeCommand had no return type, so tsc wrote the inferred execa options into the declaration, including env: ... | undefined, which execa's Options rejects under exact optional types. Our own build never sees it because it uses skipLibCheck: true.

Changes

  • Declare runNodeCommand's return type as execa's ResultPromise, so the inferred options no longer reach the .d.ts. No runtime change.
  • CI now type-checks the built declarations with strict consumer settings (typecheck:declarations), so a regression fails the build.

Tests

  • The new declarations check fails on the previous code and passes with this change.
  • bun run lint and bun test apps/cli/ pass.

@changeset-bot

changeset-bot Bot commented Nov 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: af1f366

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cartesi/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 85.18% (🎯 0%) 14091 / 16543
🔵 Statements 85.18% 14091 / 16543
🔵 Functions 79.28% 375 / 473
🔵 Branches 0% 0 / 0
📁 File Coverage (20 files)
File Lines Statements Functions Branches Uncovered Lines
apps/cli/src/api/build.ts 🔴 7.27% 🔴 7.27% 🔴 0% 🔴 0% 74-125, 130-136, 151-244
apps/cli/src/api/connection.ts 🟢 88.89% 🟢 88.89% 🟢 100% 🔴 0% 70-72
apps/cli/src/api/deposit/common.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/api/deposit/erc1155.ts 🔴 4.21% 🔴 4.21% 🔴 0% 🔴 0% 80-159, 170-263, 272-302
apps/cli/src/api/deposit/erc20.ts 🔴 8% 🔴 8% 🔴 0% 🔴 0% 32-45, 77-154
apps/cli/src/api/deposit/erc721.ts 🔴 6.3% 🔴 6.3% 🔴 0% 🔴 0% 41-50, 79-187
apps/cli/src/api/deposit/ether.ts 🔴 15.56% 🔴 15.56% 🔴 0% 🔴 0% 29-66
apps/cli/src/api/deposit/index.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/api/deposit/progress.ts 🟡 66.67% 🟡 66.67% 🔴 0% 🔴 0% 14, 18
apps/cli/src/api/doctor.ts 🔴 34.97% 🔴 34.97% 🔴 30% 🔴 0% 57-74, 79-91, 95-106, 110-1...
apps/cli/src/api/logs.ts 🔴 38.82% 🔴 38.82% 🟡 60% 🔴 0% 12-23, 136-175
apps/cli/src/api/run.ts 🔴 4.98% 🔴 4.98% 🔴 0% 🔴 0% 222-244, 248-261, 268-286, ...
apps/cli/src/api/send.ts 🟡 71.96% 🟡 71.96% 🟡 75% 🔴 0% 46-47, 74-78, 95, 104, 156-176
apps/cli/src/api/types.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/base.ts 🔴 42.11% 🔴 42.11% 🟡 70.59% 🔴 0% 62, 101-174, 200-204, 208-2...
apps/cli/src/builder/directory.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/builder/docker.ts 🟢 87.12% 🟢 87.12% 🟡 66.67% 🔴 0% 77-79, 81, 114-116, 174-183
apps/cli/src/builder/empty.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/builder/index.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/builder/none.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -

@github-project-automation github-project-automation Bot moved this from Todo to Waiting Merge in Rollups SDK Nov 25, 2026
@github-project-automation github-project-automation Bot moved this from 👁 In Review to 👍 Waiting Merge in Rollups Tooling Nov 25, 2026
@brunomenezes
brunomenezes merged commit 7218d96 into prerelease/v2-alpha Nov 25, 2026
4 checks passed
@brunomenezes
brunomenezes deleted the fix/node-command-env-declaration branch November 25, 2026 17:51
@github-project-automation github-project-automation Bot moved this from Waiting Merge to Done in Rollups SDK Nov 25, 2026
@github-project-automation github-project-automation Bot moved this from 👍 Waiting Merge to 📦 Done in Rollups Tooling Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done
Status: 📦 Done

Development

Successfully merging this pull request may close these issues.

2 participants