From 84d0e5f3c6ed696e578b99865567b4ad93814368 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 29 Nov 2018 11:24:47 -0700 Subject: [PATCH 1/9] update react-flatpickr definitions --- types/react-flatpickr/index.d.ts | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts index a0a9725ccd..973f30efc9 100644 --- a/types/react-flatpickr/index.d.ts +++ b/types/react-flatpickr/index.d.ts @@ -1,18 +1,26 @@ -// Type definitions for react-flatpickr 3.2 +// Type definitions for react-flatpickr 3.6.4 // Project: https://github.com/coderhaoxin/react-flatpickr // Definitions by: begincalendar +// snaveevans // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import { Component } from 'react'; -import flatpickr from 'flatpickr'; +import { Component } from "react"; +import flatpickr from "flatpickr"; export interface DateTimePickerProps { - defaultValue?: string; - options?: flatpickr.Options.Options; - onChange?: flatpickr.Options.Hook; - value?: string; - className?: string; + defaultValue?: string; + options?: flatpickr.Options.Options; + onChange?: flatpickr.Options.Hook; + onOpen?: flatpickr.Options.Hook; + onClose?: flatpickr.Options.Hook; + onMonthChange?: flatpickr.Options.Hook; + onYearChange?: flatpickr.Options.Hook; + onReady?: flatpickr.Options.Hook; + onValueUpdate?: flatpickr.Options.Hook; + onDayCreate?: flatpickr.Options.Hook; + value?: string | Date | number | Array; + children?: JSX.Element; } export default class DatePicker extends Component {} From f8ad24974118da570659fcaf7a6f35271e828f15 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 29 Nov 2018 11:42:10 -0700 Subject: [PATCH 2/9] refactor react-flatpickr test --- .../react-flatpickr/react-flatpickr-tests.tsx | 50 ++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/types/react-flatpickr/react-flatpickr-tests.tsx b/types/react-flatpickr/react-flatpickr-tests.tsx index 452d8529b4..ce7122a47f 100644 --- a/types/react-flatpickr/react-flatpickr-tests.tsx +++ b/types/react-flatpickr/react-flatpickr-tests.tsx @@ -1,22 +1,48 @@ -import flatpickr from 'flatpickr'; -import * as React from 'react'; -import DatePicker from 'react-flatpickr'; +import flatpickr from "flatpickr"; +import * as React from "react"; +import DatePicker from "react-flatpickr"; -const noParamsElement = ; +const noParamsElement = ; -const defaultValueElement = ; +const defaultValueElement = ; const options = { - dateFormat: 'YYYY-MM-DD' + dateFormat: "YYYY-MM-DD" }; -const optionsElement = ; +const optionsElement = ; -const onChange = ( - selectedDates: Date[], dateStr: string, instance: flatpickr.Instance, +const hook = ( + selectedDates: Date[], + dateStr: string, + instance: flatpickr.Instance, elem: HTMLElement ) => null; -const onChangeElement = ; +const onChangeElement = ; +const onOpenElement = ; +const onCloseElement = ; +const onMonthChangeElement = ; +const onYearChangeElement = ; +const onReadyElement = ; +const onValueUpdateElement = ; +const onDayCreateElement = ; -const valueElement = ; +const valueStringElement = ; +const valueDateElement = ; +const valueNumberElement = ; +const valueStringArrayElement = ( + +); +const valueDateArrayElement = ( + +); +const valueNumberArrayElement = ( + +); -const classNameElement = ; +const wrappedElement = ( + + + +); From 0085b9868c6252a56fed4690444231dbd8cb8099 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 29 Nov 2018 11:45:23 -0700 Subject: [PATCH 3/9] react-flatpickr remove minor version --- types/react-flatpickr/index.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts index 973f30efc9..9f60b4d7be 100644 --- a/types/react-flatpickr/index.d.ts +++ b/types/react-flatpickr/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-flatpickr 3.6.4 +// Type definitions for react-flatpickr 3.6 // Project: https://github.com/coderhaoxin/react-flatpickr // Definitions by: begincalendar // snaveevans @@ -9,18 +9,18 @@ import { Component } from "react"; import flatpickr from "flatpickr"; export interface DateTimePickerProps { - defaultValue?: string; - options?: flatpickr.Options.Options; - onChange?: flatpickr.Options.Hook; - onOpen?: flatpickr.Options.Hook; - onClose?: flatpickr.Options.Hook; - onMonthChange?: flatpickr.Options.Hook; - onYearChange?: flatpickr.Options.Hook; - onReady?: flatpickr.Options.Hook; - onValueUpdate?: flatpickr.Options.Hook; - onDayCreate?: flatpickr.Options.Hook; - value?: string | Date | number | Array; - children?: JSX.Element; + defaultValue?: string; + options?: flatpickr.Options.Options; + onChange?: flatpickr.Options.Hook; + onOpen?: flatpickr.Options.Hook; + onClose?: flatpickr.Options.Hook; + onMonthChange?: flatpickr.Options.Hook; + onYearChange?: flatpickr.Options.Hook; + onReady?: flatpickr.Options.Hook; + onValueUpdate?: flatpickr.Options.Hook; + onDayCreate?: flatpickr.Options.Hook; + value?: string | Date | number | Array; + children?: JSX.Element; } export default class DatePicker extends Component {} From c652a0afb4330ca150f1755bba040cf72b4ec5f5 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 29 Nov 2018 11:47:37 -0700 Subject: [PATCH 4/9] Revert "react-flatpickr remove minor version" This reverts commit 0085b9868c6252a56fed4690444231dbd8cb8099. --- types/react-flatpickr/index.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts index 9f60b4d7be..973f30efc9 100644 --- a/types/react-flatpickr/index.d.ts +++ b/types/react-flatpickr/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-flatpickr 3.6 +// Type definitions for react-flatpickr 3.6.4 // Project: https://github.com/coderhaoxin/react-flatpickr // Definitions by: begincalendar // snaveevans @@ -9,18 +9,18 @@ import { Component } from "react"; import flatpickr from "flatpickr"; export interface DateTimePickerProps { - defaultValue?: string; - options?: flatpickr.Options.Options; - onChange?: flatpickr.Options.Hook; - onOpen?: flatpickr.Options.Hook; - onClose?: flatpickr.Options.Hook; - onMonthChange?: flatpickr.Options.Hook; - onYearChange?: flatpickr.Options.Hook; - onReady?: flatpickr.Options.Hook; - onValueUpdate?: flatpickr.Options.Hook; - onDayCreate?: flatpickr.Options.Hook; - value?: string | Date | number | Array; - children?: JSX.Element; + defaultValue?: string; + options?: flatpickr.Options.Options; + onChange?: flatpickr.Options.Hook; + onOpen?: flatpickr.Options.Hook; + onClose?: flatpickr.Options.Hook; + onMonthChange?: flatpickr.Options.Hook; + onYearChange?: flatpickr.Options.Hook; + onReady?: flatpickr.Options.Hook; + onValueUpdate?: flatpickr.Options.Hook; + onDayCreate?: flatpickr.Options.Hook; + value?: string | Date | number | Array; + children?: JSX.Element; } export default class DatePicker extends Component {} From 5baad0aabf25ca9416d93f06c479d8c6e790a938 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 29 Nov 2018 11:48:28 -0700 Subject: [PATCH 5/9] react-flatpickr remove patch version --- types/react-flatpickr/index.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts index 973f30efc9..9f60b4d7be 100644 --- a/types/react-flatpickr/index.d.ts +++ b/types/react-flatpickr/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-flatpickr 3.6.4 +// Type definitions for react-flatpickr 3.6 // Project: https://github.com/coderhaoxin/react-flatpickr // Definitions by: begincalendar // snaveevans @@ -9,18 +9,18 @@ import { Component } from "react"; import flatpickr from "flatpickr"; export interface DateTimePickerProps { - defaultValue?: string; - options?: flatpickr.Options.Options; - onChange?: flatpickr.Options.Hook; - onOpen?: flatpickr.Options.Hook; - onClose?: flatpickr.Options.Hook; - onMonthChange?: flatpickr.Options.Hook; - onYearChange?: flatpickr.Options.Hook; - onReady?: flatpickr.Options.Hook; - onValueUpdate?: flatpickr.Options.Hook; - onDayCreate?: flatpickr.Options.Hook; - value?: string | Date | number | Array; - children?: JSX.Element; + defaultValue?: string; + options?: flatpickr.Options.Options; + onChange?: flatpickr.Options.Hook; + onOpen?: flatpickr.Options.Hook; + onClose?: flatpickr.Options.Hook; + onMonthChange?: flatpickr.Options.Hook; + onYearChange?: flatpickr.Options.Hook; + onReady?: flatpickr.Options.Hook; + onValueUpdate?: flatpickr.Options.Hook; + onDayCreate?: flatpickr.Options.Hook; + value?: string | Date | number | Array; + children?: JSX.Element; } export default class DatePicker extends Component {} From 47b4772299affae7d56351a46668c9624d3b0aba Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 29 Nov 2018 12:01:10 -0700 Subject: [PATCH 6/9] react-flatpickr use ReadonlyArray --- types/react-flatpickr/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts index 9f60b4d7be..f9b817bd00 100644 --- a/types/react-flatpickr/index.d.ts +++ b/types/react-flatpickr/index.d.ts @@ -19,7 +19,7 @@ export interface DateTimePickerProps { onReady?: flatpickr.Options.Hook; onValueUpdate?: flatpickr.Options.Hook; onDayCreate?: flatpickr.Options.Hook; - value?: string | Date | number | Array; + value?: string | Date | number | ReadonlyArray; children?: JSX.Element; } From 3bc0b5bec959415292efd71bf5c188eb170b550e Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 29 Nov 2018 13:25:36 -0700 Subject: [PATCH 7/9] react-flatpickr allow Element array --- types/react-flatpickr/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts index f9b817bd00..5e3b12fdf8 100644 --- a/types/react-flatpickr/index.d.ts +++ b/types/react-flatpickr/index.d.ts @@ -20,7 +20,7 @@ export interface DateTimePickerProps { onValueUpdate?: flatpickr.Options.Hook; onDayCreate?: flatpickr.Options.Hook; value?: string | Date | number | ReadonlyArray; - children?: JSX.Element; + children?: JSX.Element | JSX.Element[]; } export default class DatePicker extends Component {} From 0ccda5781a317728dc62b4889daac7f8a1b396b0 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 29 Nov 2018 13:31:29 -0700 Subject: [PATCH 8/9] react-flatpickr test multiple elements --- types/react-flatpickr/react-flatpickr-tests.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/react-flatpickr/react-flatpickr-tests.tsx b/types/react-flatpickr/react-flatpickr-tests.tsx index ce7122a47f..c51f527707 100644 --- a/types/react-flatpickr/react-flatpickr-tests.tsx +++ b/types/react-flatpickr/react-flatpickr-tests.tsx @@ -46,3 +46,10 @@ const wrappedElement = ( ); + +const wrappedElements = ( + + + + +); From f76c861cc9a2aeeadf2e6373313b4b24f9549ba8 Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 3 Dec 2018 09:23:25 -0700 Subject: [PATCH 9/9] drop children prop --- types/react-flatpickr/index.d.ts | 1 - types/react-flatpickr/react-flatpickr-tests.tsx | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts index 5e3b12fdf8..c867527b06 100644 --- a/types/react-flatpickr/index.d.ts +++ b/types/react-flatpickr/index.d.ts @@ -20,7 +20,6 @@ export interface DateTimePickerProps { onValueUpdate?: flatpickr.Options.Hook; onDayCreate?: flatpickr.Options.Hook; value?: string | Date | number | ReadonlyArray; - children?: JSX.Element | JSX.Element[]; } export default class DatePicker extends Component {} diff --git a/types/react-flatpickr/react-flatpickr-tests.tsx b/types/react-flatpickr/react-flatpickr-tests.tsx index c51f527707..7a1c64c266 100644 --- a/types/react-flatpickr/react-flatpickr-tests.tsx +++ b/types/react-flatpickr/react-flatpickr-tests.tsx @@ -40,16 +40,3 @@ const valueDateArrayElement = ( const valueNumberArrayElement = ( ); - -const wrappedElement = ( - - - -); - -const wrappedElements = ( - - - - -);