mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Abstract getters on Luzon Zone are not static.
With the current definition, several items that are supposed to be public members/methods are marked static. Since these are supposed to be returning information for a particular zone, and in the luxon source they are not static members/methods, they should not be marked as static. It is not possible to create an implementation for Zone using the current definition. References: https://moment.github.io/luxon/docs/class/src/zone.js~Zone.html https://github.com/moment/luxon/blob/master/src/zone.js
This commit is contained in:
Vendored
+6
-5
@@ -5,6 +5,7 @@
|
||||
// Jonathan Siebern <https://github.com/jsiebern>
|
||||
// Matt R. Wilson <https://github.com/mastermatt>
|
||||
// Pietro Vismara <https://github.com/pietrovismara>
|
||||
// Janeene Beeforth <https://github.com/dawnmist>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -467,11 +468,11 @@ export interface ZoneOffsetOptions {
|
||||
}
|
||||
|
||||
export class Zone {
|
||||
static offsetName(ts: number, options?: ZoneOffsetOptions): string;
|
||||
static isValid: boolean;
|
||||
static name: string;
|
||||
static type: string;
|
||||
static universal: boolean;
|
||||
offsetName(ts: number, options?: ZoneOffsetOptions): string;
|
||||
isValid: boolean;
|
||||
name: string;
|
||||
type: string;
|
||||
universal: boolean;
|
||||
equals(other: Zone): boolean;
|
||||
offset(ts: number): number;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DateTime, Duration, Interval, Info, Settings, IANAZone } from 'luxon';
|
||||
import { DateTime, Duration, Interval, Info, Settings, IANAZone, Zone, ZoneOffsetOptions } from 'luxon';
|
||||
|
||||
/* DateTime */
|
||||
const dt = DateTime.local(2017, 5, 15, 8, 30);
|
||||
@@ -285,3 +285,21 @@ dur.reconfigure({ conversionAccuracy: 'longterm' }); // $ExpectType Duration
|
||||
|
||||
start.until(end); // $ExpectType Interval
|
||||
i.toDuration(['years', 'months', 'days']); // $ExpectType Duration
|
||||
|
||||
/* Sample Zone Implementation */
|
||||
class SampleZone extends Zone {
|
||||
readonly isValid = false;
|
||||
readonly name = 'Sample';
|
||||
readonly type = 'Example';
|
||||
readonly universal = true;
|
||||
|
||||
offsetName(ts: number, options?: ZoneOffsetOptions) {
|
||||
return 'SampleZone';
|
||||
}
|
||||
equals(other: Zone) {
|
||||
return other.name === this.name;
|
||||
}
|
||||
offset(ts: number) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user