Add input-moment declarations (#37231)

* Add input-moment

* Strings

* Add File to TSConfig (sorry)

* Rename

* Package.json

* change Require

* Require index.d.ts
This commit is contained in:
Tim Ittermann
2019-07-31 20:05:07 +02:00
committed by Jesse Trinity
parent e64c46abc4
commit 95264ebcb9
5 changed files with 70 additions and 0 deletions

25
types/input-moment/index.d.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
// Type definitions for input-moment 0.4
// Project: https://github.com/wangzuo/input-moment
// Definitions by: Tim Ittermann <https://github.com/timia2109>
// 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<InputMomentProps> {
constructor(props: Readonly<InputMomentProps>);
}

View File

@@ -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 = () => <InputMoment moment={momentI} onChange={OnChange} onSave={OnSave} />;

View File

@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"moment": "latest"
}
}

View File

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

View File

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