mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 15:00:26 +00:00
feat(types/freshy): types for new module freshy
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { unload, reload, freshy } from 'freshy';
|
||||
import minimist = require('minimist');
|
||||
|
||||
declare function require(x: string): any;
|
||||
|
||||
unload('minimist'); // $ExpectType boolean
|
||||
|
||||
const reloaded = reload('minimist'); // $ExpectType any
|
||||
// $ExpectType boolean
|
||||
minimist === reloaded; // false
|
||||
|
||||
const freshlyLoaded = freshy('minimist'); // $ExpectType any
|
||||
// $ExpectType boolean
|
||||
minimist === freshlyLoaded; // false
|
||||
|
||||
let alsofresh: any;
|
||||
// $ExpectType any
|
||||
const fresh = freshy('minimist', (fresh) => {
|
||||
alsofresh = require('minimist');
|
||||
|
||||
// $ExpectType boolean
|
||||
fresh === alsofresh; // true
|
||||
});
|
||||
// $ExpectType boolean
|
||||
minimist === fresh; // false
|
||||
// $ExpectType boolean
|
||||
fresh === alsofresh; // true
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for freshy 1.0
|
||||
// Project: https://github.com/krakenjs/freshy#readme
|
||||
// Definitions by: Nikita Volodin <https://github.com/qlonik>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function unload(module: string): boolean;
|
||||
export function reload(module: string): any;
|
||||
export function freshy(module: string, cb?: (module: any) => any): any;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"freshy-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user