mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #25750 from saadq/cosmiconfig
[cosmiconfig] use optional types where appropriate
This commit is contained in:
@@ -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")),
|
||||
|
||||
Vendored
+4
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user