mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-03-31 10:44:33 +00:00
feat: add definition for looper (#43551)
This commit is contained in:
13
types/looper/index.d.ts
vendored
Normal file
13
types/looper/index.d.ts
vendored
Normal 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;
|
||||
8
types/looper/looper-tests.ts
Normal file
8
types/looper/looper-tests.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import looper = require('looper');
|
||||
|
||||
let l = 100000;
|
||||
const next = looper(() => {
|
||||
if (--l) next();
|
||||
});
|
||||
|
||||
next();
|
||||
23
types/looper/tsconfig.json
Normal file
23
types/looper/tsconfig.json
Normal 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
1
types/looper/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user