mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
hirestime: update to 4.0 API (#39664)
This commit is contained in:
parent
e827c04548
commit
f150fcd79b
@ -3,6 +3,9 @@ import hirestime = require("hirestime");
|
||||
const getElapsed = hirestime();
|
||||
|
||||
let n: number = getElapsed();
|
||||
n = getElapsed(hirestime.S);
|
||||
n = getElapsed(hirestime.MS);
|
||||
n = getElapsed(hirestime.NS);
|
||||
n = getElapsed.s();
|
||||
n = getElapsed.seconds();
|
||||
n = getElapsed.ms();
|
||||
n = getElapsed.milliseconds();
|
||||
n = getElapsed.ns();
|
||||
n = getElapsed.nanoseconds();
|
||||
|
||||
18
types/hirestime/index.d.ts
vendored
18
types/hirestime/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for hirestime 3.2
|
||||
// Type definitions for hirestime 4.0
|
||||
// Project: https://github.com/seriousManual/hirestime
|
||||
// Definitions by: Junxiao Shi <https://github.com/yoursunny>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@ -6,12 +6,14 @@
|
||||
|
||||
export = hirestime;
|
||||
|
||||
declare namespace hirestime {
|
||||
const S = "s";
|
||||
const MS = "ms";
|
||||
const NS = "ns";
|
||||
interface getElapsed {
|
||||
(): number;
|
||||
s(): number;
|
||||
seconds(): number;
|
||||
ms(): number;
|
||||
milliseconds(): number;
|
||||
ns(): number;
|
||||
nanoseconds(): number;
|
||||
}
|
||||
|
||||
type returnedFunction = (unit?: "s"|"ms"|"ns") => number;
|
||||
|
||||
declare function hirestime(): returnedFunction;
|
||||
declare function hirestime(): getElapsed;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user