mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-12 19:59:02 +08:00
Merge branch 'qlonik-freshy'
This commit is contained in:
21
types/freshy/freshy-tests.ts
Normal file
21
types/freshy/freshy-tests.ts
Normal 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
8
types/freshy/index.d.ts
vendored
Normal 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;
|
||||
23
types/freshy/tsconfig.json
Normal file
23
types/freshy/tsconfig.json
Normal 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
1
types/freshy/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user