diff --git a/types/cosmiconfig/cosmiconfig-tests.ts b/types/cosmiconfig/cosmiconfig-tests.ts index 632569c6f9..508ad00aa0 100644 --- a/types/cosmiconfig/cosmiconfig-tests.ts +++ b/types/cosmiconfig/cosmiconfig-tests.ts @@ -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")), diff --git a/types/cosmiconfig/index.d.ts b/types/cosmiconfig/index.d.ts index bdafc922ec..eb876b6ef2 100644 --- a/types/cosmiconfig/index.d.ts +++ b/types/cosmiconfig/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/davidtheclark/cosmiconfig // Definitions by: ozum // szeck87 +// 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; - searchSync(searchFrom: string): null | CosmiconfigResult; + search(searchFrom?: string): Promise; + searchSync(searchFrom?: string): null | CosmiconfigResult; load(loadPath: string): Promise; 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;