File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,25 +165,26 @@ function checkYarnVersion() {
165165 */
166166function checkTypeScriptVersion ( ) {
167167 const minVersion = '4.1.0'
168+ let output
168169 try {
169- const output = execa . sync ( 'tsc' , [ '-v' ] , {
170+ output = execa . sync ( 'tsc' , [ '-v' ] , {
170171 preferLocal : true ,
171172 } )
172- if ( output . stdout ) {
173- const currentVersion = output . stdout . split ( ' ' ) [ 1 ]
174- if ( semverLt ( currentVersion , minVersion ) ) {
175- throw new Error (
176- `Your ${ chalk . bold (
177- 'typescript' ,
178- ) } version is ${ currentVersion } , which is outdated. Please update it to ${ chalk . bold (
179- minVersion ,
180- ) } or ${ chalk . bold ( 'newer' ) } in order to use Prisma Client.`,
181- )
182- }
183- }
184173 } catch ( e ) {
185174 // They do not have TS installed, we ignore (example: JS project)
186175 }
176+ if ( output ?. stdout ) {
177+ const currentVersion = output . stdout . split ( ' ' ) [ 1 ]
178+ if ( semverLt ( currentVersion , minVersion ) ) {
179+ throw new Error (
180+ `Your ${ chalk . bold (
181+ 'typescript' ,
182+ ) } version is ${ currentVersion } , which is outdated. Please update it to ${ chalk . bold (
183+ minVersion ,
184+ ) } or ${ chalk . bold ( 'newer' ) } in order to use Prisma Client.`,
185+ )
186+ }
187+ }
187188}
188189/**
189190 * Returns true, if semver version `a` is lower than `b`
You can’t perform that action at this time.
0 commit comments