Skip to content

chore(js-sdk,cli): modernize tsconfig and bump TypeScript to 6.0#1516

Draft
mishushakov wants to merge 1 commit into
mainfrom
mishushakov/modernize-sdk-tsconfig
Draft

chore(js-sdk,cli): modernize tsconfig and bump TypeScript to 6.0#1516
mishushakov wants to merge 1 commit into
mainfrom
mishushakov/modernize-sdk-tsconfig

Conversation

@mishushakov

Copy link
Copy Markdown
Member

What & why

Now that the bundler (tsup) owns the actual emit and tsc is used only for type-checking / .d.ts generation, the compiler options can be modernized. Also bumps TypeScript across both packages.

Internal build-config change only — no public API or runtime behavior changes. Verified that pnpm test output is byte-identical before/after (the failures present in this workspace are pre-existing and purely from a missing E2B_API_KEY).

Compiler options: before → after

packages/js-sdk/tsconfig.json

option before after
target es6 es2022
lib ["dom","ESNext"] ["dom","es2022"]
module (unset) esnext
moduleResolution node bundler
allowJs true removed (no .js sources)
allowSyntheticDefaultImports true removed (implied by esModuleInterop)
ignoreDeprecations "6.0" (added — see note)

packages/cli/tsconfig.json

option before after
moduleResolution node bundler
strictNullChecks, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, noImplicitThis, alwaysStrict true removed (all implied by strict: true)
downlevelIteration true removed (deprecated in TS 6.0; no-op at es2022)
baseUrl "." removed (deprecated in TS 6.0)
paths { e2b } { src, "src/*", e2b } (replaces baseUrl for the existing src/... import style)
outDir "dist" removed (see note)

target/lib for the CLI were already es2022, so they're unchanged.

TypeScript

Both packages: typescript ^5.4.5^6.0.3.

Decisions & behavior-affecting notes

  • Target stayed at es2022, not es2023. The repo is still on Node 20 (.tool-versions = nodejs 20.19.5, engines >= 20, @types/node ^20); the Node 22 migration hasn't landed, so I used the agreed es2022 fallback.

  • moduleResolution: "bundler" is the headline risk. Both packages typecheck and build cleanly under it (module: es2022/esnext are both compatible with bundler). For the CLI, the previous baseUrl-based bare imports (import … from 'src/user', from 'src') are preserved by mapping them through paths; the bundled output still resolves them (build verified, CLI binary smoke-tested).

  • TS 6.0 fallout (because we picked TS 6 over "latest 5.x"):

    • baseUrl and downlevelIteration are deprecated for removal in TS 7.0; removed both.
    • CLI outDir removal: under tsc --noEmit, TS 6.0 now validates the inferred rootDir against all program files. The e2b../js-sdk/src path mapping pulls js-sdk source into the CLI program, which lives outside packages/cli, producing TS6059. Removing outDir (unused by --noEmit; tsup has its own output config) stops rootDir inference and clears the error with no build impact.
    • js-sdk ignoreDeprecations: "6.0": tsup 8.4.0's .d.ts builder hardcodes a (now-deprecated) baseUrl (baseUrl: compilerOptions.baseUrl || "."), which fails the DTS build on TS 6.0. There's no way to stop the injection from config, so this silences it. It's commented in the file and should be removed once we migrate to tsdown (which is also why the original plan preferred basing this on the tsdown branch).

Not done (intentionally)

  • verbatimModuleSyntax — would require 177 import type conversions (78 js-sdk + 99 cli, all TS1484), spreading this config PR across many source files. Left out as excessive churn; can be a follow-up.
  • Shared tsconfig.base.json — the two configs share only ~8 options and diverge on many more (lib, module, paths, rootDirs, isolatedModules, preserveSymlinks, etc.), so it doesn't factor out cleanly. Skipped to avoid forcing it.

Verification

  • pnpm run typecheck ✅ both packages
  • pnpm run build ✅ both packages (js-sdk ESM + CJS + DTS; cli CJS; binary smoke-tested with --version)
  • pnpm run lint ✅ both packages (oxlint)
  • pnpm run format — no changes
  • pnpm run test — neutral: identical pass/fail to the pristine tree (237 failed | 127 passed | 1 skipped, all failures from missing E2B_API_KEY in this workspace; pure-logic unit tests pass)

🤖 Generated with Claude Code

Now that the bundler (tsup) owns emit and `tsc` is type-check only, the
compiler options can be modernized:

- bump `typescript` to `^6.0.3` in both packages
- js-sdk: target/lib `es6`->`es2022`, add `module: esnext`,
  `moduleResolution` `node`->`bundler`; drop `allowJs` (no JS sources) and
  `allowSyntheticDefaultImports` (implied by `esModuleInterop`)
- cli: `moduleResolution` `node`->`bundler`; drop strict-implied flags
  (strictNullChecks, strictFunctionTypes, strictBindCallApply,
  strictPropertyInitialization, noImplicitThis, alwaysStrict) and the
  deprecated `downlevelIteration` (no-op at es2022)
- cli: replace TS6-deprecated `baseUrl` with explicit `paths`, and drop
  `outDir` (unused under `tsc --noEmit`; it triggered a TS6 rootDir check
  against js-sdk source pulled in via the `e2b` path mapping)
- js-sdk: add `ignoreDeprecations: "6.0"` to silence the deprecated
  `baseUrl` that tsup's d.ts builder hardcodes; removable once we move to
  tsdown

Target stays at es2022 (still on Node 20). No public API or runtime change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 78bf701

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

This PR includes changesets to release 2 packages
Name Type
@e2b/cli Patch
e2b 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

@cursor

cursor Bot commented Jun 30, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Build and type-check configuration only; main watchpoint is moduleResolution: bundler and TS 6 stricter checks, but changesets describe verified typecheck/build/test parity.

Overview
Internal build-only change for e2b (js-sdk) and @e2b/cli: bumps TypeScript to ^6.0.3 and refreshes tsconfig.json so tsc is type-check / declaration generation while tsup still owns emit.

For js-sdk, compile target/lib move from es6 / ESNext to es2022, module: esnext, and moduleResolution: bundler. Redundant flags (allowJs, allowSyntheticDefaultImports) are dropped. ignoreDeprecations: "6.0" is added to tolerate tsup’s injected deprecated baseUrl during .d.ts builds.

For CLI, moduleResolution: bundler, TS 6–deprecated options removed (baseUrl, downlevelIteration, redundant strict* flags, outDir to fix TS6059 when js-sdk sources are pulled in via the e2b path). paths now maps src / src/* so existing bare src/... imports keep working without baseUrl.

Patch changesets for both packages; lockfile updated. No application source or public API changes intended.

Reviewed by Cursor Bugbot for commit 78bf701. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from eb54914. Download artifacts from this workflow run.

JS SDK (e2b@2.31.1-mishushakov-modernize-sdk-tsconfig.0):

npm install ./e2b-2.31.1-mishushakov-modernize-sdk-tsconfig.0.tgz

CLI (@e2b/cli@2.13.1-mishushakov-modernize-sdk-tsconfig.0):

npm install ./e2b-cli-2.13.1-mishushakov-modernize-sdk-tsconfig.0.tgz

Python SDK (e2b==2.30.0+mishushakov-modernize-sdk-tsconfig):

pip install ./e2b-2.30.0+mishushakov.modernize.sdk.tsconfig-py3-none-any.whl

@mishushakov mishushakov marked this pull request as draft June 30, 2026 14:13

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78bf7014f6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

"declaration": true,
// tsup's d.ts builder always injects `baseUrl` (deprecated in TS 6.0). This
// silences that deprecation; remove once we migrate off tsup (tsdown).
"ignoreDeprecations": "6.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add Node types when migrating to TS6

With TypeScript 6, compilerOptions.types defaults to [], so installing @types/node is no longer enough for this config to see Node globals/built-ins. pnpm run typecheck/pnpm build will hit TS2591/TS2503 on existing usages such as process/NodeJS.Timeout in packages/js-sdk/src/template/logger.ts and Buffer in packages/js-sdk/src/envd/rpc.ts; the CLI config changed in this commit has the same problem for its tests. Add "types": ["node"] to the affected tsconfigs instead of only suppressing TS6 deprecations.

Useful? React with 👍 / 👎.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build-only change with thorough verification and no bugs found, but the TypeScript 5→6 major bump plus the moduleResolution: bundler switch and the deprecation workarounds (ignoreDeprecations, outDir removal, baseUrlpaths remap) are non-trivial — worth a human eye on the build pipeline.

Extended reasoning...

Overview

Touches only build configuration for two packages: packages/js-sdk and packages/cli. Bumps typescript from ^5.4.5 to ^6.0.3, switches moduleResolution to bundler, raises js-sdk target/lib to es2022/es2022, removes options that are now redundant under strict / esModuleInterop or deprecated in TS 6.0, and remaps the CLI's src/src/* bare imports through paths to replace the removed baseUrl. A changeset entry (patch for both packages) and the pnpm lockfile update accompany the change. No source code or public API is modified.

Security risks

None meaningful. Configuration of a build/typecheck toolchain doesn't change runtime behavior, and the published artifacts are still emitted by tsup with its own config. No auth, crypto, network, or permission code is involved.

Level of scrutiny

Medium — higher than a typical config tweak. It's a build-only change so blast radius is bounded, but it is a major TypeScript version bump (5 → 6) accompanied by several non-obvious workarounds the author flagged themselves: ignoreDeprecations: "6.0" silences a tsup-internal deprecation, outDir is removed from the CLI tsconfig to dodge a new TS 6 rootDir inference (TS6059), and the CLI's baseUrl-based bare imports are remapped through paths to keep from 'src/...' resolving. The switch to moduleResolution: bundler also changes how tsc resolves imports during type-check / dts generation. Any one of these is reasonable; together they merit a human eye on the build pipeline.

Other factors

The author reports successful typecheck, build (including .d.ts), lint, and that pnpm test produces an identical pass/fail breakdown to the pristine tree (failures are pre-existing API-key-missing failures). The CLI binary was smoke-tested with --version. The bug-hunting system found no issues, and the cursor bot summary characterizes the change as low risk. The changeset is correctly scoped as a patch for both packages. The combination of "thoroughly verified" plus "major toolchain bump with caveats the author flagged" is exactly the case where a human reviewer adds the most value — the verification is strong but the surface area of behavior changes in TS 6 is broad enough that I'd rather a maintainer sign off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant