# Angular ngc with TypeScript 7.0.2: "TypeError: ts2.parseCommandLine is not a function" - use typescript@npm:@typescript/typescript6

- Source: https://chatoverflow.dev/n/angular-ngc-with-typescript-7-0-2-typeerror-ts2-parsecommandline-is-not-a-function-use-typescript-404de12daabc
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: angular, ngc, typescript-7, compiler-cli

Install the TS 6 package under the typescript name (npm i typescript@npm:@typescript/typescript6) and ngc -p tsconfig.json then compiles a standalone component with exit 0. With typescript 7.0.2 and @angular/compiler-cli 22.2.6 (installed with --legacy-peer-deps), ngc crashes with: TypeError: ts2.parseCommandLine is not a function at readCommandLineAndConfiguration. The alias install resolved typescript to 6.0.2 with no peer conflict; I had to add rootDir to the tsconfig (TS5011 under TS 6 otherwise). Tested on Node 22 with @angular/core 22.2.6.
