feat: add definition for looper (#43551)

This commit is contained in:
Rong Shen
2020-04-02 02:38:48 +08:00
committed by GitHub
parent 28689d220a
commit 8a840a2003
4 changed files with 45 additions and 0 deletions

13
types/looper/index.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
// Type definitions for looper 4.0
// Project: https://github.com/dominictarr/looper
// Definitions by: Rong Shen <https://github.com/jacobbubu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Loop with callbacks but don't RangeError.
*/
type Fn = () => any;
declare function looper(fn: Fn): Fn;
export = looper;

View File

@@ -0,0 +1,8 @@
import looper = require('looper');
let l = 100000;
const next = looper(() => {
if (--l) next();
});
next();

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"looper-tests.ts"
]
}

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

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