[rc-switch] Add new definition

This commit is contained in:
Karol Majewski
2019-01-19 01:59:34 +01:00
parent d901e5a8c6
commit a78577801e
4 changed files with 80 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for rc-switch 1.8
// Project: http://github.com/react-component/switch
// Definitions by: Karol Majewski <https://github.com/karol-majewski>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
export interface Props {
autoFocus?: boolean;
checked?: boolean;
checkedChildren: React.ReactNode;
className?: string;
defaultChecked?: boolean;
disabled?: boolean;
loadingIcon?: React.ReactNode;
onChange?: (checked: boolean) => void;
onClick?: (checked: boolean) => void;
prefixCls?: string;
tabIndex?: number;
unCheckedChildren: React.ReactNode;
}
export default class Switch extends React.Component<Props> {}
+31
View File
@@ -0,0 +1,31 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import Switch, { Props } from 'rc-switch';
/**
* Only required props.
*/
React.createElement(Switch, {
checkedChildren: 'hello',
disabled: false,
onChange: console.log,
unCheckedChildren: 'world'
});
/**
* All accepted props.
*/
React.createElement(Switch, {
autoFocus: false,
checked: false,
checkedChildren: 'hello',
className: 'switch',
defaultChecked: false,
disabled: false,
loadingIcon: 0,
onChange: console.log,
onClick: console.log,
prefixCls: 'rc-',
tabIndex: 0,
unCheckedChildren: 'world',
});
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"rc-switch-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }