Merge branch 'qlonik-freshy'

This commit is contained in:
Andy Hanson
2018-05-07 09:10:25 -07:00
4 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
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
minimist === reloaded; // false
const freshlyLoaded = freshy('minimist'); // $ExpectType any
minimist === freshlyLoaded; // false
let alsofresh: any;
// $ExpectType any
const fresh = freshy('minimist', (fresh) => {
alsofresh = require('minimist');
fresh === alsofresh; // true
});
minimist === fresh; // false
fresh === alsofresh; // true

8
types/freshy/index.d.ts vendored Normal file
View File

@@ -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;

View File

@@ -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"
]
}

1
types/freshy/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }