Skip to content

Commit

Permalink
Fix constants typings generation bug (closes #2491)
Browse files Browse the repository at this point in the history
Fixed constant typings.
  • Loading branch information
kossnocorp committed May 28, 2021
1 parent b0c6a04 commit 04a2d68
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 64 deletions.
99 changes: 55 additions & 44 deletions src/constants/index.ts
@@ -1,45 +1,50 @@
/**
* Days in 1 week.
* Days in 1 week.
*
* @constant
* @type {number}
* @default
* @name daysInWeek
* @constant
* @type {number}
* @default
*/
export const daysInWeek = 7

/**
* Maximum allowed time.
* Maximum allowed time.
*
* @constant
* @type {number}
* @default
* @name maxTime
* @constant
* @type {number}
* @default
*/
export const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000

/**
* Milliseconds in 1 minute
* Milliseconds in 1 minute
*
* @constant
* @type {number}
* @default
* @name millisecondsInMinute
* @constant
* @type {number}
* @default
*/
export const millisecondsInMinute = 60000

/**
* Milliseconds in 1 hour
* Milliseconds in 1 hour
*
* @constant
* @type {number}
* @default
* @name millisecondsInHour
* @constant
* @type {number}
* @default
*/
export const millisecondsInHour = 3600000

/**
* Milliseconds in 1 second
* Milliseconds in 1 second
*
* @constant
* @type {number}
* @default
* @name millisecondsInSecond
* @constant
* @type {number}
* @default
*/
export const millisecondsInSecond = 1000

Expand All @@ -54,55 +59,61 @@ export const millisecondsInSecond = 1000
export const minTime = -maxTime

/**
* Minutes in 1 hour
* Minutes in 1 hour
*
* @constant
* @type {number}
* @default
* @name minutesInHour
* @constant
* @type {number}
* @default
*/
export const minutesInHour = 60

/**
* Months in 1 quarter
* Months in 1 quarter
*
* @constant
* @type {number}
* @default
* @name monthsInQuarter
* @constant
* @type {number}
* @default
*/
export const monthsInQuarter = 3

/**
* Months in 1 year
* Months in 1 year
*
* @constant
* @type {number}
* @default
* @name monthsInYear
* @constant
* @type {number}
* @default
*/
export const monthsInYear = 12

/**
* Quarters in 1 year
* Quarters in 1 year
*
* @constant
* @type {number}
* @default
* @name quartersInYear
* @constant
* @type {number}
* @default
*/
export const quartersInYear = 4

/**
* Seconds in 1 hour
* Seconds in 1 hour
*
* @constant
* @type {number}
* @default
* @name secondsInHour
* @constant
* @type {number}
* @default
*/
export const secondsInHour = 3600

/**
* Seconds in 1 minute
* Seconds in 1 minute
*
* @constant
* @type {number}
* @default
* @name secondsInMinute
* @constant
* @type {number}
* @default
*/
export const secondsInMinute = 60
4 changes: 2 additions & 2 deletions src/fp/index.js.flow
Expand Up @@ -611,15 +611,15 @@ declare module.exports: {
yearsToMonths: CurriedFn1<number, number>,
yearsToQuarters: CurriedFn1<number, number>,
daysInWeek: number,
daysInWeek: number,
maxTime: number,
millisecondsInMinute: number,
millisecondsInHour: number,
minTime: number,
millisecondsInSecond: number,
minTime: number,
minutesInHour: number,
monthsInQuarter: number,
monthsInYear: number,
quartersInYear: number,
secondsInHour: number,
secondsInMinute: number,
}
6 changes: 3 additions & 3 deletions src/index.js.flow
Expand Up @@ -836,15 +836,13 @@ declare module.exports: {

daysInWeek: number,

daysInWeek: number,

maxTime: number,

millisecondsInMinute: number,

millisecondsInHour: number,

minTime: number,
millisecondsInSecond: number,

minTime: number,

Expand All @@ -857,4 +855,6 @@ declare module.exports: {
quartersInYear: number,

secondsInHour: number,

secondsInMinute: number,
}
30 changes: 15 additions & 15 deletions typings.d.ts
Expand Up @@ -1130,15 +1130,13 @@ declare module 'date-fns' {

const daysInWeek: number

const daysInWeek: number

const maxTime: number

const millisecondsInMinute: number

const millisecondsInHour: number

const minTime: number
const millisecondsInSecond: number

const minTime: number

Expand All @@ -1151,6 +1149,8 @@ declare module 'date-fns' {
const quartersInYear: number

const secondsInHour: number

const secondsInMinute: number
}

declare module 'date-fns/add' {
Expand Down Expand Up @@ -5597,15 +5597,13 @@ declare module 'date-fns/fp' {

const daysInWeek: number

const daysInWeek: number

const maxTime: number

const millisecondsInMinute: number

const millisecondsInHour: number

const minTime: number
const millisecondsInSecond: number

const minTime: number

Expand All @@ -5618,6 +5616,8 @@ declare module 'date-fns/fp' {
const quartersInYear: number

const secondsInHour: number

const secondsInMinute: number
}

declare module 'date-fns/fp/add' {
Expand Down Expand Up @@ -10230,15 +10230,13 @@ declare module 'date-fns/esm' {

const daysInWeek: number

const daysInWeek: number

const maxTime: number

const millisecondsInMinute: number

const millisecondsInHour: number

const minTime: number
const millisecondsInSecond: number

const minTime: number

Expand All @@ -10251,6 +10249,8 @@ declare module 'date-fns/esm' {
const quartersInYear: number

const secondsInHour: number

const secondsInMinute: number
}

declare module 'date-fns/esm/add' {
Expand Down Expand Up @@ -14697,15 +14697,13 @@ declare module 'date-fns/esm/fp' {

const daysInWeek: number

const daysInWeek: number

const maxTime: number

const millisecondsInMinute: number

const millisecondsInHour: number

const minTime: number
const millisecondsInSecond: number

const minTime: number

Expand All @@ -14718,6 +14716,8 @@ declare module 'date-fns/esm/fp' {
const quartersInYear: number

const secondsInHour: number

const secondsInMinute: number
}

declare module 'date-fns/esm/fp/add' {
Expand Down Expand Up @@ -22012,15 +22012,13 @@ interface dateFns {

daysInWeek: number

daysInWeek: number

maxTime: number

millisecondsInMinute: number

millisecondsInHour: number

minTime: number
millisecondsInSecond: number

minTime: number

Expand All @@ -22033,4 +22031,6 @@ interface dateFns {
quartersInYear: number

secondsInHour: number

secondsInMinute: number
}

0 comments on commit 04a2d68

Please sign in to comment.