Merge pull request #32753 from apavlinovic/master

Adds elo-rank typings
This commit is contained in:
Sheetal Nandi
2019-03-18 13:38:44 -07:00
committed by GitHub
4 changed files with 47 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
import EloRank from "elo-rank";
const test = new EloRank();
test.getKFactor(); // $ExpectType number
test.getExpected(1200, 1500); // $ExpectType number
test.updateRating(test.getExpected(1200, 1500), 1300, 1500); // $ExpectType number
+15
View File
@@ -0,0 +1,15 @@
// 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
// TypeScript Version: 2.7
declare 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;
}
export = EloRank;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"elo-rank-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }