diff --git a/types/input-moment/index.d.ts b/types/input-moment/index.d.ts new file mode 100644 index 0000000000..c0f95dce60 --- /dev/null +++ b/types/input-moment/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for input-moment 0.4 +// Project: https://github.com/wangzuo/input-moment +// Definitions by: Tim Ittermann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.5 + +import React = require('react'); +import moment = require('moment'); + +export type OnChangeListener = (m: moment.Moment) => void; +export type OnSaveListener = () => void; + +export interface InputMomentProps { + moment: moment.Moment; + onChange?: OnChangeListener; + onSave?: OnSaveListener; + minStep?: number; + hourStep?: number; + prevMonthIcon?: string; + nextMonthIcon?: string; +} + +export default class InputMoment extends React.Component { + constructor(props: Readonly); +} diff --git a/types/input-moment/input-moment-tests.tsx b/types/input-moment/input-moment-tests.tsx new file mode 100644 index 0000000000..d630cf9514 --- /dev/null +++ b/types/input-moment/input-moment-tests.tsx @@ -0,0 +1,10 @@ +import React = require('react'); +import InputMoment from 'input-moment'; +import moment = require('moment'); + +const momentI = moment(); + +const OnChange: (m: moment.Moment) => void = (m: moment.Moment) => console.log(m); +const OnSave: () => void = () => console.log('Save'); + +const InputMomentTest: React.SFC = () => ; diff --git a/types/input-moment/package.json b/types/input-moment/package.json new file mode 100644 index 0000000000..bfde8cdada --- /dev/null +++ b/types/input-moment/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "moment": "latest" + } +} \ No newline at end of file diff --git a/types/input-moment/tsconfig.json b/types/input-moment/tsconfig.json new file mode 100644 index 0000000000..880aab6bcc --- /dev/null +++ b/types/input-moment/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "allowSyntheticDefaultImports": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "preserve" + }, + "files": [ + "index.d.ts", + "input-moment-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/input-moment/tslint.json b/types/input-moment/tslint.json new file mode 100644 index 0000000000..24c5d28658 --- /dev/null +++ b/types/input-moment/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file