Created definitions for "react-flatpickr" v3.2. (#15933)

This commit is contained in:
Matt 2017-04-20 12:05:03 +10:00 committed by Andy
parent 925b70ecb7
commit c71a29462a
4 changed files with 62 additions and 0 deletions

17
types/react-flatpickr/index.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
// Type definitions for react-flatpickr 3.2
// Project: https://github.com/coderhaoxin/react-flatpickr
// Definitions by: begincalendar <https://github.com/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<DateTimePickerProps, void> {}

View File

@ -0,0 +1,20 @@
import * as Flatpickr from 'flatpickr';
import * as React from 'react';
import DatePicker from 'react-flatpickr';
const noParamsElement = <DatePicker/>;
const defaultValueElement = <DatePicker defaultValue={ 'Default value' }/>;
const options = {
dateFormat: 'YYYY-MM-DD'
};
const optionsElement = <DatePicker options={ options }/>;
const onChange = (
selectedDates: Date[], dateStr: string, instance: Flatpickr,
elem: HTMLElement
) => null;
const onChangeElement = <DatePicker onChange={ onChange }/>;
const valueElement = <DatePicker value={ 'Value' }/>;

View File

@ -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"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }