[pretty-hrtime] Add types

This commit is contained in:
Dimitri Benin
2019-01-01 15:17:57 +01:00
parent 0d851ec699
commit 2d9e9d30e3
4 changed files with 48 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for pretty-hrtime 1.0
// Project: https://github.com/robrich/pretty-hrtime
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = prettyHrtime;
declare function prettyHrtime(hrTime: [number, number], options?: prettyHrtime.Options): string;
declare namespace prettyHrtime {
interface Options {
verbose?: boolean;
precise?: boolean;
}
}
@@ -0,0 +1,9 @@
/// <reference types="node" />
import prettyHrtime = require('pretty-hrtime');
const hrtime = process.hrtime();
prettyHrtime(hrtime); // $ExpectType string
prettyHrtime(hrtime, { verbose: true }); // $ExpectType string
prettyHrtime(hrtime, { precise: true }); // $ExpectType string
+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",
"pretty-hrtime-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }