Add types for barbellweights module (#27302)

* Add types for barbellweights

* Add types for barbellweights
This commit is contained in:
evelijn
2018-07-15 12:31:28 -07:00
committed by Ryan Cavanaugh
parent 26defd42ae
commit 1f95827a0d
4 changed files with 79 additions and 0 deletions
@@ -0,0 +1,33 @@
import { BarbellWeight } from "barbellweights";
let calculator: BarbellWeight;
let results: any;
calculator = new BarbellWeight(200, "bench press");
results = calculator.getResults();
calculator = new BarbellWeight(500, "deadlift");
results = calculator.getResults();
calculator = new BarbellWeight(400, "squat");
results = calculator.getResults();
calculator = new BarbellWeight(400, "deadlift", { program: "QUARTER" });
results = calculator.getResults();
calculator = new BarbellWeight(400, "deadlift", { bar: 45 });
results = calculator.getResults();
calculator = new BarbellWeight(400, "deadlift", { plates: [45, 10, 5] });
results = calculator.getResults();
calculator = new BarbellWeight(400, "deadlift", { warmup_round_to: 5 });
results = calculator.getResults();
calculator = new BarbellWeight(300, "squat", {
program: "STARTING_STRENGTH",
bar: 45,
plates: [45, 25, 10, 5],
warmup_round_to: 5
});
results = calculator.getResults();
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for barbellweights 0.4
// Project: https://github.com/toddhibbs/barbellweight#readme
// Definitions by: evelijn <https://github.com/evelijn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface options {
program?: string;
bar?: number;
plates?: number[];
warmup_round_to?: number;
}
export class BarbellWeight {
constructor(workingWeight: number, lift: string, options?: options);
getResults(): any;
}
export namespace BarbellWeight {
namespace BarbellWeight {
function getResults(): void;
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"barbellweights-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }