balena-supervisor/typings/duration-js.d.ts

63 lines
1.8 KiB
TypeScript
Raw Permalink Normal View History

// From: https://github.com/icholy/Duration.js/pull/15
// Once the above is merged, use the inbuilt module types
// tslint:disable
2018-11-02 14:17:58 +00:00
declare module 'duration-js' {
type DurationLike = Duration | string | number;
type DateLike = Date | number;
class Duration {
private _milliseconds: number;
constructor(value?: DurationLike);
static millisecond: Duration;
2018-11-02 14:17:58 +00:00
static second: Duration;
static minute: Duration;
static hour: Duration;
static day: Duration;
static week: Duration;
static milliseconds(milliseconds: number): Duration;
2018-11-02 14:17:58 +00:00
static seconds(seconds: number): Duration;
static minutes(minutes: number): Duration;
static hours(hours: number): Duration;
static days(days: number): Duration;
static weeks(weeks: number): Duration;
2018-11-02 14:17:58 +00:00
nanoseconds(): number;
microseconds(): number;
milliseconds(): number;
2018-11-02 14:17:58 +00:00
seconds(): number;
minutes(): number;
hours(): number;
days(): number;
weeks(): number;
toString(): string;
2018-11-02 14:17:58 +00:00
valueOf(): number;
isGreaterThan(duration: DurationLike): boolean;
2018-11-02 14:17:58 +00:00
isLessThan(duration: DurationLike): boolean;
isEqualTo(duration: DurationLike): boolean;
roundTo(duration: DurationLike): void;
after(date: DateLike): Date;
2018-11-02 14:17:58 +00:00
static since(date: DateLike): Duration;
static until(date: DateLike): Duration;
static between(a: DateLike, b: DateLike): Duration;
2018-11-02 14:17:58 +00:00
static parse(duration: string): Duration;
static fromMicroseconds(us: number): Duration;
static fromNanoseconds(ns: number): Duration;
2018-11-02 14:17:58 +00:00
static add(a: Duration, b: Duration): Duration;
static subtract(a: Duration, b: Duration): Duration;
2018-11-02 14:17:58 +00:00
static multiply(a: Duration, b: number): Duration;
static multiply(a: number, b: Duration): Duration;
static divide(a: Duration, b: Duration): number;
static abs(d: DurationLike): Duration;
}
export = Duration;
2018-11-02 14:17:58 +00:00
}