Skip to content

Commit

Permalink
feat: when tsconfig.json file not exist, use empty config
Browse files Browse the repository at this point in the history
  • Loading branch information
plantain-00 committed Nov 3, 2018
1 parent 98ce1a3 commit b1d5480
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions spec/result.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src/tsconfig.ts:35:31: config
src/tsconfig.ts:32:57: config
src/core.ts:30:45: intrinsicName
src/core.ts:39:159: intrinsicName
src/index.ts:15:37: v
Expand All @@ -11,5 +11,5 @@ src/index.ts:23:106: debug
src/index.ts:44:4: error
src/index.ts:45:7: error
src/index.ts:48:17: error
3180 / 3193 99.59%
3178 / 3191 99.59%
type-coverage success.
5 changes: 1 addition & 4 deletions src/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ type JsonConfig = {

export function getTsConfig(configFilePath: string, dirname: string): JsonConfig {
const configResult = ts.readConfigFile(configFilePath, p => fs.readFileSync(p).toString())
if (configResult.error) {
throw configResult.error
}
const config = configResult.config as JsonConfig
const config = configResult.error ? {} : configResult.config as JsonConfig
if (config.extends) {
const project = path.resolve(dirname, config.extends)
const { configFilePath, dirname: extendsBasename } = getTsConfigFilePath(project)
Expand Down

0 comments on commit b1d5480

Please sign in to comment.