Skip to content

Support TypeScript 7: adapt CLI to work without the programmatic Compiler API #3479

Description

@joaosousafranco

Is there an existing issue for this?

  • I have searched the existing issues

Why this issue exists alongside #3477 / #3478

#3477 reported the crash when using @nestjs/cli with TypeScript 7.0.2, and #3478 addressed it by adding an early detection guard with an actionable error message. That fix is valuable — users now get a clear "install TypeScript 6" message instead of a raw TypeError.

However, #3478 is a diagnostic improvement, not a compatibility fix. The CLI still cannot run nest build, nest start, or nest start --watch with TypeScript 7. This issue tracks the actual work needed to make the CLI functional with TypeScript 7.

Current behavior

With typescript@7.0.2 installed, all compiler-dependent CLI commands fail because the Node module no longer exports the programmatic Compiler API (getParsedCommandLineOfConfigFile, createProgram, createWatchProgram, getPreEmitDiagnostics, etc.). This affects both the default tsc builder and the SWC builder (which uses the programmatic API for type-checking).

The only workaround today is to bypass the CLI entirely for compilation:

{
  "build": "tsc",
  "dev": "concurrently \"tsc --watch --preserveWatchOutput\" \"node --watch-path=dist dist/src/main.js\""
}

This works, but users lose CLI features like plugin metadata generation, the integrated SWC type-checker, and the unified nest build/nest start interface.

Expected behavior

nest build and nest start should work with TypeScript 7 once the programmatic API stabilizes (expected in TypeScript 7.1), or the CLI should provide an alternative compilation path that does not depend on it.

Context

TypeScript 7.0 was rewritten in Go and only ships the tsc CLI executable. Microsoft has stated the programmatic Compiler API is expected to return in TypeScript 7.1, but there is no confirmed timeline. As TypeScript 7 adoption grows, more users will hit this incompatibility.

Package version

11.0.24

NestJS version

11.1.28

Node.js version

v26.5.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions