diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts new file mode 100644 index 0000000000..8d77c689cb --- /dev/null +++ b/types/react-flatpickr/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for react-flatpickr 3.2 +// Project: https://github.com/coderhaoxin/react-flatpickr +// Definitions by: begincalendar +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { Component } from 'react'; +import { EventCallback, Options } from 'flatpickr'; + +export interface DateTimePickerProps { + defaultValue?: string; + options?: Options; + onChange?: EventCallback; + value?: string; +} + +export default class DatePicker extends Component {} diff --git a/types/react-flatpickr/react-flatpickr-tests.tsx b/types/react-flatpickr/react-flatpickr-tests.tsx new file mode 100644 index 0000000000..948b65e84e --- /dev/null +++ b/types/react-flatpickr/react-flatpickr-tests.tsx @@ -0,0 +1,20 @@ +import * as Flatpickr from 'flatpickr'; +import * as React from 'react'; +import DatePicker from 'react-flatpickr'; + +const noParamsElement = ; + +const defaultValueElement = ; + +const options = { + dateFormat: 'YYYY-MM-DD' +}; +const optionsElement = ; + +const onChange = ( + selectedDates: Date[], dateStr: string, instance: Flatpickr, + elem: HTMLElement +) => null; +const onChangeElement = ; + +const valueElement = ; diff --git a/types/react-flatpickr/tsconfig.json b/types/react-flatpickr/tsconfig.json new file mode 100644 index 0000000000..ea43a6c994 --- /dev/null +++ b/types/react-flatpickr/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "jsx": "react", + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-flatpickr-tests.tsx" + ] +} diff --git a/types/react-flatpickr/tslint.json b/types/react-flatpickr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-flatpickr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }