[convert-hrtime] add typings (#18812)

This commit is contained in:
Dimitri Benin
2017-08-11 01:48:58 +02:00
committed by Mohamed Hegazy
parent 963cd2108f
commit 68575400ca
4 changed files with 48 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
/// <reference types="node" />
import convertHrtime = require('convert-hrtime');
const time = convertHrtime(process.hrtime(process.hrtime()));
let num: number;
num = time.seconds;
num = time.milliseconds;
num = time.nanoseconds;

16
types/convert-hrtime/index.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
// Type definitions for convert-hrtime 2.0
// Project: https://github.com/sindresorhus/convert-hrtime#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = convertHrtime;
declare function convertHrtime(hrtime: [number, number]): convertHrtime.HRTime;
declare namespace convertHrtime {
interface HRTime {
seconds: number;
milliseconds: number;
nanoseconds: number;
}
}

View File

@@ -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",
"convert-hrtime-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }