Merge pull request #31165 from BendingBender/to-milliseconds

Add types for @sindresorhus/to-milliseconds
This commit is contained in:
Andrew Casey
2018-12-07 15:18:59 -08:00
committed by GitHub
4 changed files with 73 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for @sindresorhus/to-milliseconds 1.0
// Project: https://github.com/sindresorhus/to-milliseconds
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = toMilliseconds;
declare function toMilliseconds(input: toMilliseconds.TimeSpec): number;
declare namespace toMilliseconds {
interface TimeSpec {
days?: number;
hours?: number;
minutes?: number;
seconds?: number;
milliseconds?: number;
microseconds?: number;
nanoseconds?: number;
}
}
@@ -0,0 +1,24 @@
import toMilliseconds = require('@sindresorhus/to-milliseconds');
// $ExpectType number
toMilliseconds({
days: 15,
});
toMilliseconds({
hours: 11,
});
toMilliseconds({
minutes: 23,
});
toMilliseconds({
seconds: 20,
});
toMilliseconds({
milliseconds: 1,
});
toMilliseconds({
microseconds: 1,
});
toMilliseconds({
nanoseconds: 1,
});
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"paths": {
"@sindresorhus/to-milliseconds": [
"sindresorhus__to-milliseconds"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"sindresorhus__to-milliseconds-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }