diff --git a/types/react-radio-group/index.d.ts b/types/react-radio-group/index.d.ts new file mode 100644 index 0000000000..9628561b61 --- /dev/null +++ b/types/react-radio-group/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for react-radio-group 3.0 +// Project: https://github.com/chenglou/react-radio-group +// Definitions by: Jason Unger +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; + +export type Value = React.InputHTMLAttributes['value']; + +export type RadioProps = React.InputHTMLAttributes; + +export const Radio: React.ComponentClass; + +export interface RadioGroupProps { + name?: string; + selectedValue?: Value; + onChange?: (value: Value) => void; + Component?: string | React.ReactElement>; +} + +export const RadioGroup: React.ComponentClass; diff --git a/types/react-radio-group/react-radio-group-tests.tsx b/types/react-radio-group/react-radio-group-tests.tsx new file mode 100644 index 0000000000..65cd53fab3 --- /dev/null +++ b/types/react-radio-group/react-radio-group-tests.tsx @@ -0,0 +1,24 @@ +import * as React from 'react'; +import { Radio, RadioGroup, RadioGroupProps, Value } from "react-radio-group"; + +class ReactRadioGroup extends React.Component { + constructor(props: RadioGroupProps) { + super(props); + } + + handleChange(value: Value) { + console.log(value); + } + + render() { + return ( +
+ + + + + +
+ ); + } +} diff --git a/types/react-radio-group/tsconfig.json b/types/react-radio-group/tsconfig.json new file mode 100644 index 0000000000..615f55eee3 --- /dev/null +++ b/types/react-radio-group/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-radio-group-tests.tsx" + ] +} diff --git a/types/react-radio-group/tslint.json b/types/react-radio-group/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-radio-group/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }