Skip to content

0.3.0 regression: TS2790 on delete of index-signature properties (ProcessEnv, DOMStringMap); 0.2.0 and tsc 7.1.0-dev report none #52

Open

Description

@cruihan

Summary

tsc-rs 0.3.0 reports TS2790: The operand of a 'delete' operator must be optional. on delete of properties that come from a string index signature (NodeJS.ProcessEnv, DOMStringMap) with exactOptionalPropertyTypes: true. tsc-rs 0.2.0 and typescript@7.1.0-dev.20260929.1 (the revision the port is pinned to) report none on the same tree, so this looks like a regression between v0.2.0 and v0.3.0.

Counts

Checked a T3 Code checkout based on v0.0.45 with --noEmit --incremental false --composite false:

Checker apps/server apps/web
tsc-rs 0.3.0 (release archive tsc-rs-0.3.0-darwin-arm64.tar.gz, SHA256 matches SHA256SUMS) 25 3
tsc-rs 0.2.0 (release archive, SHA256 matches) 0 0
typescript@7.1.0-dev.20260929.1 0 0
typescript 7.0.2 0 0

The result is deterministic: apps/server gives 25 with --checkers 1, --checkers 4 and --singleThreaded.

Example sites

All of these files exist upstream in T3 Code:

  • apps/server/src/os-jank.test.ts: delete process.env.HOME;
  • apps/server/src/vcs/GitVcsDriver.test.ts: delete process.env.GIT_DIR;
  • apps/server/src/provider/CodexManagedRuntime.ts: const environment: NodeJS.ProcessEnv = { ... }; delete environment.T3CODE_CODEX_LAUNCH_ARGS;
  • apps/server/src/textGeneration/ClaudeTextGeneration.test.ts, provider/Layers/CursorAdapter.test.ts, provider/acp/AcpJsonRpcConnection.test.ts
  • apps/web/src/themePalette.ts: delete root.dataset.themeId;
  • apps/web/src/components/chat/AssistantCitationSource.tsx, components/chat/draftHeroTransition.ts: delete el.dataset.x

Does not reproduce in isolation

  • One file containing export {}; delete process.env.HOME;, the same compilerOptions as apps/server (strict, exactOptionalPropertyTypes, noUncheckedIndexedAccess, module/moduleResolution NodeNext, lib: ["ESNext", "esnext.disposable"], types: ["node"]) and @types/node 24.12.4: 0 errors on 0.3.0.
  • A tsconfig that extends apps/server/tsconfig.json with files: ["src/os-jank.test.ts"] (99 non-node_modules files in the program): 0 errors.
  • Only the full apps/server program (2,350 files) reproduces it. So the result seems to depend on what has been checked earlier in the program.

Environment

  • tsc-rs 0.3.0, darwin-arm64 release archive (run as the binary, not via npm)
  • macOS (Darwin 25.6.0), Apple M5 Pro
  • @types/node 24.12.4

I found this while timing tsc-rs on this project. The speedup holds up: 21.0 s → 8.4 s over five projects with the Effect diagnostics on.

Activity

  1. added a commit that references this issue on Oct 11, 2026
  2. t3dotgg commented on Oct 11, 2026

    @t3dotgg
    Member

    Note

    🤖 Claude Opus 5.5 responding on behalf of Theo

    Thanks for the clear report. We reproduced it on T3 Code v0.0.45 (linux-x64): 24 TS2790 in apps/server and 3 in apps/web.

    The checker did not change between 0.2.0 and 0.3.0. 0.3.0 moved the built-in Effect diagnostics from effect-tsgo 0.46.1 to 0.51.1. The unstableApiUsage and experimentalApiUsage rules came in between, in effect-tsgo 0.47.0. T3 Code's tsconfig.base.json enables the @effect/language-service plugin, so these rules run.

    Why it happens: the two rules look up the symbol of each identifier. For obj.key, where key comes from an index signature (process.env, dataset), that lookup saves an index-signature symbol on the node. A later Effect rule asks for the type of the delete expression, which runs the delete check again. The check now sees that saved symbol, which is not optional, so with exactOptionalPropertyTypes it reports TS2790.

    effect-tsgo 0.51.1 prints the same lines; its output on both apps is the same as tsc-rs 0.3.0, byte for byte. Plain typescript 7.x prints none because it does not run the plugin. T3 Code's own pin, @effect/tsgo 0.41.0, prints none because it is older than these rules. With the plugin, it reproduces in one file. For your extends + files: ["src/os-jank.test.ts"] setup we get 1 TS2790 on 0.3.0, main and effect-tsgo 0.51.1. We do not yet know why you got 0 there, or 25 instead of 24 on apps/server. The upstream issue is Effect-TS/tsgo#820.

    Workaround: turn the two rules off in the existing diagnosticSeverity map of the plugin entry:

    "diagnosticSeverity": { "unstableApiUsage": "off", "experimentalApiUsage": "off" }

    With this, tsc-rs 0.3.0 gives 0 TS2790 on both apps, and the same output as 0.2.0. A child tsconfig with "plugins": [] does not turn off the inherited plugin, so use the rule options.

    tsc-rs keeps its Effect output equal to effect-tsgo 0.51.1. We will port the upstream fix when it lands.

  3. added
    upstream issue
    on Oct 11, 2026
  4. added a commit that references this issue on Oct 11, 2026
  5. IAmJSD commented on Nov 6, 2026

    @IAmJSD
    Contributor

    Still reproduces on tsc-rs 0.8.0 (via @tsc-rs/typescript, darwin-arm64), and the upstream fix now exists, so this looks ready to port.

    Minimal repro, one file, no @types/node:

    // a.ts
    declare const env: { [key: string]: string | undefined };
    delete env.FOO;
    delete env["BAR"];
    {
      "compilerOptions": {
        "strict": true,
        "noEmit": true,
        "types": [],
        "exactOptionalPropertyTypes": true,
        "plugins": [{ "name": "@effect/language-service" }]
      },
      "files": ["a.ts"]
    }
    a.ts(2,8): error TS2790: The operand of a 'delete' operator must be optional.
    
    exactOptionalPropertyTypes Plugin entry Result
    false enabled clean
    true none clean
    true "diagnostics": false clean
    true unstableApiUsage and experimentalApiUsage off clean
    true enabled TS2790 on line 2

    Only the dotted form reports; delete env["BAR"] on line 3 is clean. This also fits the earlier "does not reproduce in isolation" result: the file needs no large program around it, only the plugin and exactOptionalPropertyTypes.

    Upstream: Effect-TS/tsgo#820 closed on 2026-10-12 with Effect-TS/tsgo#828 (merge 7d051dd5). That merge is 15 commits ahead of 47cb1ed7, the @effect/tsgo@0.51.1 commit PORTING.md pins, so the pin does not include it. I only tested the 0.8.0 release, not current main.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions