diff --git a/types/elo-rank/elo-rank-tests.ts b/types/elo-rank/elo-rank-tests.ts new file mode 100644 index 0000000000..7cf7955a14 --- /dev/null +++ b/types/elo-rank/elo-rank-tests.ts @@ -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 \ No newline at end of file diff --git a/types/elo-rank/index.d.ts b/types/elo-rank/index.d.ts new file mode 100644 index 0000000000..c2a797cbcb --- /dev/null +++ b/types/elo-rank/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for elo-rank 1.0 +// Project: https://github.com/dmamills/elo-rank#readme +// Definitions by: Antonio Pavlinovic +// 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; +} diff --git a/types/elo-rank/tsconfig.json b/types/elo-rank/tsconfig.json new file mode 100644 index 0000000000..7ec166bf13 --- /dev/null +++ b/types/elo-rank/tsconfig.json @@ -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" + ] +} diff --git a/types/elo-rank/tslint.json b/types/elo-rank/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/elo-rank/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }