mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
remove IDayOfWeekMonth in favor of a tuple of [number, number] with refactor
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
/// <reference path="node-calendar" />
|
||||
/// <reference path="../node/node" />
|
||||
|
||||
import node_calendar = require('node-calendar');
|
||||
|
||||
@@ -97,7 +96,7 @@ function assertIsNumber(n: number) {
|
||||
assert(typeof n == 'number', 'Should be a number');
|
||||
}
|
||||
|
||||
function assertDayOfWeekMonth(d: IDayOfWeekMonth) {
|
||||
function assertDayOfWeekMonth(d: [number, number]) {
|
||||
assert(d instanceof Array, 'Day of weak/month should be an array');
|
||||
assert(d.length == 2, 'Day of weak/month array should contain 2 items');
|
||||
assert(typeof d[0] == 'number', 'Day of month should be a number');
|
||||
|
||||
Vendored
+3
-11
@@ -3,14 +3,6 @@
|
||||
// Definitions by: Luzian Zagadinow <https://github.com/luzianz>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface IDayOfWeekMonth extends Array<number> {
|
||||
/** dayOfMonth */
|
||||
0: number;
|
||||
|
||||
/** dayOfWeek */
|
||||
1: number;
|
||||
}
|
||||
|
||||
interface IWeekRow<T> extends Array<T> {
|
||||
[dayIndex: number]: T;
|
||||
}
|
||||
@@ -183,7 +175,7 @@ declare module 'node-calendar' {
|
||||
* @param {number} month
|
||||
* Month for which the calendar should be generated.
|
||||
*/
|
||||
itermonthdays2(year: number, month: number): IDayOfWeekMonth[];
|
||||
itermonthdays2(year: number, month: number): [number, number][];
|
||||
|
||||
/**
|
||||
* A matrix (array of array) representing a month's calendar.
|
||||
@@ -217,7 +209,7 @@ declare module 'node-calendar' {
|
||||
* @param {number} month
|
||||
* Month for which the calendar should be generated.
|
||||
*/
|
||||
monthdays2calendar(year: number, month: number): IMonthGrid<IDayOfWeekMonth>;
|
||||
monthdays2calendar(year: number, month: number): IMonthGrid<[number, number]>;
|
||||
|
||||
/**
|
||||
* The specified year ready for formatting. The return value is an array
|
||||
@@ -254,7 +246,7 @@ declare module 'node-calendar' {
|
||||
* @param {number} width
|
||||
* The number of months to include in each row. Default: 3
|
||||
*/
|
||||
yeardays2calendar(year: number, width?: number): IYearGrid<IDayOfWeekMonth>;
|
||||
yeardays2calendar(year: number, width?: number): IYearGrid<[number, number]>;
|
||||
}
|
||||
|
||||
// Undocumented
|
||||
|
||||
Reference in New Issue
Block a user