Merge pull request #33552 from adamzerella/types/pretty-time

[pretty-time] Add typing for pretty-time
This commit is contained in:
Nathan Shively-Sanders
2019-03-05 06:49:48 -08:00
committed by GitHub
4 changed files with 83 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
// Type definitions for pretty-time 1.1
// Project: https://github.com/jonschlinkert/pretty-time
// Definitions by: Adam Zerella <https://github.com/adamzerella>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.3
type Increment =
| 'ns'
| 'nano'
| 'nanosecond'
| 'nanoseconds'
| 'μs'
| 'micro'
| 'microsecond'
| 'microseconds'
| 'ms'
| 'milli'
| 'millisecond'
| 'milliseconds'
| 's'
| 'sec'
| 'second'
| 'seconds'
| 'm'
| 'min'
| 'minute'
| 'minutes'
| 'h'
| 'hr'
| 'hour'
| 'hours'
| 'd'
| 'day'
| 'days'
| 'w'
| 'wk'
| 'week'
| 'weeks';
declare function prettyTime(time: number[], smallest?: Increment, digits?: number): string;
export = prettyTime;
+13
View File
@@ -0,0 +1,13 @@
import DateTime = require("pretty-time");
DateTime([1200708, 795428088]);
DateTime([0, 795428088]);
DateTime([0, 795428088], 'h');
DateTime([0, 795428088], 'm');
DateTime([0, 795428088], 'μs', 2);
DateTime([0, 795428088], 'ms', 1);
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [
],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"pretty-time-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}