mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #28145 from seangenabe/round-to
Add typings for round-to
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for round-to 3.0
|
||||
// Project: https://github.com/sindresorhus/round-to#readme
|
||||
// Definitions by: Sean Marvi Oliver Genabe <https://github.com/seangenabe>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace roundTo {
|
||||
/**
|
||||
* Round the decimals with `Math.ceil`.
|
||||
* @param input Number to adjust.
|
||||
* @param precision (Integer) number of decimal places.
|
||||
*/
|
||||
function up(input: number, precision: number): number;
|
||||
/**
|
||||
* Round the decimals with `Math.floor`.
|
||||
* @param input Number to adjust.
|
||||
* @param precision (Integer) number of decimal places.
|
||||
*/
|
||||
function down(input: number, precision: number): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Round the decimals with `Math.round`.
|
||||
* @param input Number to adjust.
|
||||
* @param precision (integer) Number of decimal places.
|
||||
*/
|
||||
declare function roundTo(input: number, precision: number): number;
|
||||
|
||||
export = roundTo;
|
||||
@@ -0,0 +1,10 @@
|
||||
import roundTo = require('round-to');
|
||||
|
||||
// $ExpectType number
|
||||
roundTo(1.234, 2);
|
||||
|
||||
// $ExpectType number
|
||||
roundTo.up(1.234, 2);
|
||||
|
||||
// $ExpectType number
|
||||
roundTo.down(1.234, 2);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"round-to-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user