Skip to content

Commit

Permalink
Mark config as non-optional in result
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Jul 22, 2016
1 parent 98f1157 commit 25ecf18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ See the [TypeScript wiki](https://github.com/Microsoft/TypeScript/wiki/tsconfig.
* **resolveSync(cwd: string, path?: string): string | void** Synchronous `resolve`.
* **find(cwd: string): Promise<string | void>** Standalone behaviour of recursively resolving `tsconfig.json` upward.
* **findSync(cwd: string): string | void** Synchronous `find`.
* **load(cwd: string, path?: string): Promise<{ path?: string, config?: any}>** Resolve, load and parse `tsconfig.json`.
* **loadSync(cwd: string, path?: string): { path?: string, config?: any}** Synchronous `load`.
* **load(cwd: string, path?: string): Promise<{ path?: string, config: any }>** Resolve, load and parse `tsconfig.json`.
* **loadSync(cwd: string, path?: string): { path?: string, config: any }** Synchronous `load`.
* **readFile(filename: string): Promise<any>** Read a JSON file as `tsconfig.json` (strip BOM, parse JSON and support empty contents).
* **readFileSync(filename: string): any** Synchronous `readFile`.
* **parse(contents: string, filename: string): any** Parse file contents as `tsconfig.json` (strip BOM, parse JSON and support empty contents).
Expand Down
6 changes: 3 additions & 3 deletions src/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import stripComments = require('strip-json-comments')

export interface LoadResult {
path?: string
config?: any
config: any
}

const CONFIG_FILENAME = 'tsconfig.json'
Expand Down Expand Up @@ -123,12 +123,12 @@ export function load (cwd: string, filename?: string): Promise<LoadResult> {
return resolve(cwd, filename)
.then<LoadResult>(path => {
if (path == null) {
return Promise.resolve({
return Promise.resolve<LoadResult>({
config: {}
})
}

return readFile(path as string).then(config => ({ config, path }))
return readFile(path as string).then(config => ({ path: path as string, config }))
})
}

Expand Down

0 comments on commit 25ecf18

Please sign in to comment.