UNPKG

1.52 kBTypeScriptView Raw
1/**
2 * Require Fresh Callback in typical errback style.
3 * @param error if the `require` call threw, this is its error
4 * @param result if the `require` call performed succesfully, this is its result
5 */
6export type Errback = (error: Error | undefined, result: any) => any;
7/**
8 * Require the path without any caching.
9 * @param path the path to require
10 * @returns the result of the `require` call
11 * @throws note that the `require` call may throw if something went wrong requiring the path
12 */
13export declare function requireFresh(path: string): any;
14export default requireFresh;
15/**
16 * Require the path without any caching, but catch errors into the callback.
17 * Error cannot be returned because what if the module intended to RETURN (not throw) an error, hence why callback is used, as it can differentiate between returned and thrown errors.
18 * @param path the path to require
19 * @param next the callback
20 * @returns {void}
21 */
22export declare function requireFreshCallback(path: string, next: Errback): void;
23export declare const requireFreshSafe: typeof requireFreshCallback;
24/**
25 * Require the path without any caching, but catch errors into the callback.
26 * Error cannot be returned because what if the module intended to RETURN (not throw) an error, hence why promise is used, as it can differentiate between returned and thrown errors.
27 * @param path the path to require
28 * @returns {void}
29 */
30export declare function requireFreshPromise(path: string): Promise<unknown>;
31//# sourceMappingURL=index.d.ts.map
\No newline at end of file