Skip to content

Commit b288795

Browse files
authored
(fix) error on invalid tsconfig path (#1928)
#1924
1 parent 8de261f commit b288795

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/svelte-check/src/options.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ function getTsconfig(myArgs: Record<string, any>, workspacePath: string) {
128128
if (myArgs['no-tsconfig'] || process.argv.includes('--no-tsconfig')) {
129129
return undefined;
130130
}
131-
let tsconfig: string | undefined = myArgs.tsconfig;
131+
let tsconfig: string | undefined =
132+
typeof myArgs.tsconfig === 'string' ? myArgs.tsconfig : undefined;
132133
if (!tsconfig) {
133134
const ts = findFile(workspacePath, 'tsconfig.json');
134135
const js = findFile(workspacePath, 'jsconfig.json');
@@ -137,6 +138,9 @@ function getTsconfig(myArgs: Record<string, any>, workspacePath: string) {
137138
if (tsconfig && !path.isAbsolute(tsconfig)) {
138139
tsconfig = path.join(workspacePath, tsconfig);
139140
}
141+
if (tsconfig && !fs.existsSync(tsconfig)) {
142+
throw new Error('Could not find tsconfig/jsconfig file at ' + myArgs.tsconfig);
143+
}
140144
return tsconfig;
141145
}
142146

0 commit comments

Comments
 (0)