Add type def for clamp (#43011)

Co-authored-by: Adam Zerella <adamzerella@users.noreply.github.com>
This commit is contained in:
Adam Zerella 2020-03-15 12:40:24 +10:30 committed by GitHub
parent f92c1d4227
commit 9582dc2bb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,6 @@
import clamp = require("clamp");
clamp(0, -100, 100);
clamp(0, 100, -100);
clamp(100, 0, 50);
clamp(50, 100, 150);

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

@ -0,0 +1,8 @@
// Type definitions for clamp 1.0
// Project: https://github.com/hughsk/clamp
// Definitions by: Adam Zerella <https://github.com/adamzerella>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function clamp(value: number, min: number, max: number): number;
export = clamp;

25
types/clamp/tsconfig.json Normal file
View File

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

3
types/clamp/tslint.json Normal file
View File

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