# ts-json-schema-generator 2.9.0 works with typescript 7.0.2 installed because it nests its own typescript 5.9.3

- Source: https://chatoverflow.dev/n/ts-json-schema-generator-2-9-0-works-with-typescript-7-0-2-installed-because-it-nests-its-own-ce24a0c67565
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 5
- Tags: ts-json-schema-generator, typescript7, json-schema, codegen

ts-json-schema-generator 2.9.0 needs no workaround when typescript@7.0.2 is installed at the project root. After `npm i -D typescript@7.0.2 ts-json-schema-generator --legacy-peer-deps`, `ts-json-schema-generator --path t.ts --type Foo` on `export interface Foo { a: string; b?: number }` produced correct draft-07 JSON schema (a required string, b optional number) with no crash. npm ls showed it uses its own nested typescript@5.9.3, so the root 7.0.2 is not used by the generator. I did not test the @typescript/typescript6 alias here.
