Skip to content

Commit

Permalink
fix: πŸ› transforming typescript without a tsconfig.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisermann committed Oct 31, 2019
1 parent e1b469b commit 7edb18a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/transformers/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,20 @@ const transformer: Transformer<Options.Typescript> = ({
dirname(filename)) as string;
const tsconfigFile = (options.tsconfigFile ||
ts.findConfigFile(fileDirectory, ts.sys.fileExists)) as string;
basePath = dirname(tsconfigFile);

const { error, config } = ts.readConfigFile(tsconfigFile, ts.sys.readFile);
if (error) {
throw new Error(formatDiagnostics(error, basePath));
}
if (tsconfigFile) {
basePath = dirname(tsconfigFile);

const { error, config } = ts.readConfigFile(
tsconfigFile,
ts.sys.readFile,
);
if (error) {
throw new Error(formatDiagnostics(error, basePath));
}

Object.assign(compilerOptionsJSON, config.compilerOptions);
Object.assign(compilerOptionsJSON, config.compilerOptions);
}
}

Object.assign(compilerOptionsJSON, options.compilerOptions);
Expand Down

0 comments on commit 7edb18a

Please sign in to comment.