Skip to content

Commit

Permalink
Fix Options typings (#433)
Browse files Browse the repository at this point in the history
* Fix max, min and parse typings

* Fix typing generation

* Regenerate stuff
  • Loading branch information
leshakoss committed Feb 13, 2017
1 parent 3a225d6 commit bfcf14d
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 125 deletions.
2 changes: 1 addition & 1 deletion dist/date_fns_docs.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/build_typings.js
Expand Up @@ -89,7 +89,7 @@ function getType (types, {props = [], forceArray = false, indent = 1} = {}) {
return `${correctTypeCase(arrayType)}[]`
}

if (props.length > 0) {
if (type === 'Object' && props.length > 0) {
return getParams(props, {indent: indent + 1})
}

Expand Down
4 changes: 1 addition & 3 deletions src/difference_in_calendar_weeks/index.js.flow
Expand Up @@ -32,7 +32,5 @@ type Locale = {
declare module.exports: (
dateLeft: Date | string | number,
dateRight: Date | string | number,
options?: {
weekStartsOn?: number
}
options?: Options
) => number
6 changes: 1 addition & 5 deletions src/distance_in_words/index.js.flow
Expand Up @@ -32,9 +32,5 @@ type Locale = {
declare module.exports: (
dateToCompare: Date | string | number,
date: Date | string | number,
options?: {
includeSeconds?: boolean,
addSuffix?: boolean,
locale?: Locale
}
options?: Options
) => string
7 changes: 1 addition & 6 deletions src/distance_in_words_strict/index.js.flow
Expand Up @@ -32,10 +32,5 @@ type Locale = {
declare module.exports: (
dateToCompare: Date | string | number,
date: Date | string | number,
options?: {
addSuffix?: boolean,
unit?: 's' | 'm' | 'h' | 'd' | 'M' | 'Y',
partialMethod?: 'floor' | 'ceil' | 'round',
locale?: Locale
}
options?: Options
) => string
4 changes: 1 addition & 3 deletions src/end_of_week/index.js.flow
Expand Up @@ -31,7 +31,5 @@ type Locale = {

declare module.exports: (
date: Date | string | number,
options?: {
weekStartsOn?: number
}
options?: Options
) => Date
4 changes: 1 addition & 3 deletions src/format/index.js.flow
Expand Up @@ -32,7 +32,5 @@ type Locale = {
declare module.exports: (
date: Date | string | number,
format: string,
options?: {
locale?: Locale
}
options?: Options
) => string
4 changes: 1 addition & 3 deletions src/is_same_week/index.js.flow
Expand Up @@ -32,7 +32,5 @@ type Locale = {
declare module.exports: (
dateLeft: Date | string | number,
dateRight: Date | string | number,
options?: {
weekStartsOn?: number
}
options?: Options
) => boolean
4 changes: 1 addition & 3 deletions src/last_day_of_week/index.js.flow
Expand Up @@ -31,7 +31,5 @@ type Locale = {

declare module.exports: (
date: Date | string | number,
options?: {
weekStartsOn?: number
}
options?: Options
) => Date
1 change: 1 addition & 0 deletions src/max/index.js
Expand Up @@ -9,6 +9,7 @@ import toDate from '../to_date/index.js'
* Return the latest of the given dates.
*
* @param {Date[]|String[]|Number[]} datesArray - the dates to compare
* @param {Options} [options] - the object with options. See [Options]{@link docs/Options}
* @returns {Date} the latest of the dates
*
* @example
Expand Down
3 changes: 2 additions & 1 deletion src/max/index.js.flow
Expand Up @@ -30,5 +30,6 @@ type Locale = {
}

declare module.exports: (
datesArray: (Date | string | number)[]
datesArray: (Date | string | number)[],
options?: Options
) => Date
1 change: 1 addition & 0 deletions src/min/index.js
Expand Up @@ -9,6 +9,7 @@ import toDate from '../to_date/index.js'
* Return the earliest of the given dates.
*
* @param {Date[]|String[]|Number[]} datesArray - the dates to compare
* @param {Options} [options] - the object with options. See [Options]{@link docs/Options}
* @returns {Date} the earliest of the dates
*
* @example
Expand Down
3 changes: 2 additions & 1 deletion src/min/index.js.flow
Expand Up @@ -30,5 +30,6 @@ type Locale = {
}

declare module.exports: (
datesArray: (Date | string | number)[]
datesArray: (Date | string | number)[],
options?: Options
) => Date
5 changes: 1 addition & 4 deletions src/parse/index.js.flow
Expand Up @@ -33,8 +33,5 @@ declare module.exports: (
dateString: string,
formatString: string,
baseDate: Date | string | number,
options?: {
locale?: Locale,
weekStartsOn?: number
}
options?: Options
) => Date
4 changes: 1 addition & 3 deletions src/set_day/index.js.flow
Expand Up @@ -32,7 +32,5 @@ type Locale = {
declare module.exports: (
date: Date | string | number,
day: number,
options?: {
weekStartsOn?: number
}
options?: Options
) => Date
4 changes: 1 addition & 3 deletions src/start_of_week/index.js.flow
Expand Up @@ -31,7 +31,5 @@ type Locale = {

declare module.exports: (
date: Date | string | number,
options?: {
weekStartsOn?: number
}
options?: Options
) => Date
4 changes: 1 addition & 3 deletions src/to_date/index.js.flow
Expand Up @@ -31,7 +31,5 @@ type Locale = {

declare module.exports: (
argument: Date | string | number,
options?: {
additionalDigits?: 0 | 1 | 2
}
options?: Options
) => Date

0 comments on commit bfcf14d

Please sign in to comment.