diff --git a/types/rc-time-picker/index.d.ts b/types/rc-time-picker/index.d.ts new file mode 100644 index 0000000000..62f6a7711a --- /dev/null +++ b/types/rc-time-picker/index.d.ts @@ -0,0 +1,54 @@ +// Type definitions for rc-time-picker 3.4 +// Project: http://github.com/react-component/time-picker +// Definitions by: Frithjof Winkelmann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as moment from "moment"; +import * as React from 'react'; + +interface TimePickerProps { + prefixCls: string; + clearText: string; + disabled: boolean; + allowEmpty: boolean; + open: boolean; + defaultValue: moment.Moment; + defaultOpenValue: moment.Moment; + value: moment.Moment; + placeholder: string; + className: string; + id: string; + popupClassName: string; + showHour: boolean; + showMinute: boolean; + showSecond: boolean; + format: string; + disabledHours: () => number[]; + disabledMinutes: (hour: number) => number[]; + disabledSeconds: (hour: number, minute: number) => number[]; + use12Hours: boolean; + hideDisabledOptions: boolean; + onChange: (value: moment.Moment) => void; + addon: (timepicker: TimePicker) => JSX.Element; + placement: string; + transitionName: string; + onOpen: (state: { open: boolean }) => void; + onClose: (state: { open: boolean }) => void; + hourStep: number; + minuteStep: number; + secondStep: number; + focusOnOpen: boolean; + inputReadOnly: boolean; + inputIcon: React.ReactNode; + clearIcon: React.ReactNode; +} + +declare class TimePicker extends React.Component> { + constructor(props: Readonly>) + + close(): void; + isAM(): boolean; +} + +export = TimePicker; diff --git a/types/rc-time-picker/rc-time-picker-tests.tsx b/types/rc-time-picker/rc-time-picker-tests.tsx new file mode 100644 index 0000000000..7f0ea63e9c --- /dev/null +++ b/types/rc-time-picker/rc-time-picker-tests.tsx @@ -0,0 +1,10 @@ +import TimePicker from 'rc-time-picker'; +import * as React from 'react'; +import moment from 'moment'; + + {}} + placeholder={'Input time'} + showSecond={false} + onOpen={({open}: { open: boolean }) => {}}/>; diff --git a/types/rc-time-picker/tsconfig.json b/types/rc-time-picker/tsconfig.json new file mode 100644 index 0000000000..adda4c82bb --- /dev/null +++ b/types/rc-time-picker/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "rc-time-picker-tests.tsx" + ] +} diff --git a/types/rc-time-picker/tslint.json b/types/rc-time-picker/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rc-time-picker/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }