mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-03 23:42:50 +00:00
[ecma-proposal-math-extensions] Add typings (#27187)
This commit is contained in:
parent
2d845a15d2
commit
47af8e9886
@ -0,0 +1,7 @@
|
||||
import "ecma-proposal-math-extensions";
|
||||
|
||||
Math.scale(42, 21, 64, 0, 100);
|
||||
Math.fscale(0.42, 0.21, 0.64, 0.0, 1.0);
|
||||
Math.clamp(42, 0, 100);
|
||||
Math.radians(180) === 180 * Math.DEG_PER_RAD;
|
||||
Math.degrees(Math.PI) === Math.PI * Math.RAD_PER_DEG;
|
||||
52
types/ecma-proposal-math-extensions/index.d.ts
vendored
Normal file
52
types/ecma-proposal-math-extensions/index.d.ts
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
// Type definitions for ecma-proposal-math-extensions 0.0
|
||||
// Project: https://github.com/rwaldron/proposal-math-extensions#readme
|
||||
// Definitions by: Konstantin Simon Maria Möllers <https://github.com/ksm2>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.0
|
||||
|
||||
interface Math {
|
||||
/** This is the number of how many degrees are one radian. */
|
||||
readonly DEG_PER_RAD: number;
|
||||
/** This is the number of how many radians are one degree. */
|
||||
readonly RAD_PER_DEG: number;
|
||||
/**
|
||||
* Scales a value between `inLow` and `inHigh` to the range of `outLow` to `outHigh`.
|
||||
* @param x The numeric value in the input range to scale.
|
||||
* @param inLow The lower bound of the input range.
|
||||
* @param inHigh The upper bound of the input range.
|
||||
* @param outLow The lower bound of the output range.
|
||||
* @param outHigh The upper bound of the output range.
|
||||
* @return The input value scaled to the output range.
|
||||
*/
|
||||
scale(x: number, inLow: number, inHigh: number, outLow: number, outHigh: number): number;
|
||||
/**
|
||||
* Scales a floating point value between `inLow` and `inHigh` to the range of `outLow` to `outHigh`.
|
||||
* @param x The numeric value in the input range to scale.
|
||||
* @param inLow The lower bound of the input range.
|
||||
* @param inHigh The upper bound of the input range.
|
||||
* @param outLow The lower bound of the output range.
|
||||
* @param outHigh The upper bound of the output range.
|
||||
* @return The input value scaled to the output range.
|
||||
*/
|
||||
fscale(x: number, inLow: number, inHigh: number, outLow: number, outHigh: number): number;
|
||||
/**
|
||||
* Clamps an incoming value `x` to a range between `lower` and `upper`.
|
||||
* @param x The value to clamp.
|
||||
* @param lower The lower bound of the range to clamp `x` to.
|
||||
* @param upper The upper bound of the range to clamp `x` to.
|
||||
* @return The input value clamped to the given range.
|
||||
*/
|
||||
clamp(x: number, lower: number, upper: number): number;
|
||||
/**
|
||||
* Converts an angle given in degrees to an angle given in radians.
|
||||
* @param degrees The input angle in degrees.
|
||||
* @return The output angle in radians.
|
||||
*/
|
||||
radians(degrees: number): number;
|
||||
/**
|
||||
* Converts an angle given in radians to an angle given in degrees.
|
||||
* @param radians The input angle in radians.
|
||||
* @return The output angle in degrees.
|
||||
*/
|
||||
degrees(radians: number): number;
|
||||
}
|
||||
25
types/ecma-proposal-math-extensions/tsconfig.json
Normal file
25
types/ecma-proposal-math-extensions/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"target": "es2017",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ecma-proposal-math-extensions-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/ecma-proposal-math-extensions/tslint.json
Normal file
1
types/ecma-proposal-math-extensions/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user