Adds elo-rank typings

This commit is contained in:
Antonio Pavlinovic
2019-02-04 11:07:51 +01:00
parent 5196b2f647
commit 1cb13b7179
4 changed files with 44 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
import EloRank from 'elo-rank';
var test = new EloRank();
test.getKFactor(); // $ExpectType number
test.getExpected(1200, 1500); // $ExpectType number
test.updateRating(test.getExpected(1200, 1500), 1300, 1500); // $ExpectType number
+14
View File
@@ -0,0 +1,14 @@
// Type definitions for elo-rank 1.0
// Project: https://github.com/dmamills/elo-rank#readme
// Definitions by: Antonio Pavlinovic <https://github.com/apavlinovic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export class EloRank {
constructor(kFactor?: number);
setKFactor(kFactor: number): void;
getKFactor(): number;
getExpected(a: number, b: number): number;
updateRating(expected: number, actual: number, current: number): number;
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"elo-rank-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }