Merge pull request #25750 from saadq/cosmiconfig

[cosmiconfig] use optional types where appropriate
This commit is contained in:
Ron Buckton
2018-05-14 13:40:09 -07:00
committed by GitHub
2 changed files with 8 additions and 3 deletions
+4
View File
@@ -11,8 +11,12 @@ const explorer = cosmiconfig("yourModuleName", {
ignoreEmptySearchPlaces: false,
});
const explorer2 = cosmiconfig("yourModuleName");
Promise.all([
explorer.search(),
explorer.search(path.join(__dirname)),
explorer.searchSync(),
explorer.searchSync(path.join(__dirname)),
explorer.load(path.join(__dirname, "sample-config.json")),
explorer.loadSync(path.join(__dirname, "sample-config.json")),
+4 -3
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/davidtheclark/cosmiconfig
// Definitions by: ozum <https://github.com/ozum>
// szeck87 <https://github.com/szeck87>
// saadq <https://github.com/saadq>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -35,8 +36,8 @@ export interface Loaders {
}
export interface Explorer {
search(searchFrom: string): Promise<null | CosmiconfigResult>;
searchSync(searchFrom: string): null | CosmiconfigResult;
search(searchFrom?: string): Promise<null | CosmiconfigResult>;
searchSync(searchFrom?: string): null | CosmiconfigResult;
load(loadPath: string): Promise<CosmiconfigResult>;
loadSync(loadPath: string): CosmiconfigResult;
clearLoadCache(): void;
@@ -55,4 +56,4 @@ export interface ExplorerOptions {
ignoreEmptySearchPlaces?: boolean;
}
export default function cosmiconfig(moduleName: string, options: ExplorerOptions): Explorer;
export default function cosmiconfig(moduleName: string, options?: ExplorerOptions): Explorer;