mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-04 19:42:46 +08:00
Use namespaces
This commit is contained in:
24
types/react-radio-group/index.d.ts
vendored
24
types/react-radio-group/index.d.ts
vendored
@@ -6,17 +6,19 @@
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export type Value = React.InputHTMLAttributes<HTMLInputElement>['value'];
|
||||
type Value = React.InputHTMLAttributes<HTMLInputElement>['value'];
|
||||
|
||||
export type RadioProps = React.InputHTMLAttributes<HTMLInputElement>;
|
||||
|
||||
export const Radio: React.ComponentClass<RadioProps>;
|
||||
|
||||
export interface RadioGroupProps {
|
||||
name?: string;
|
||||
selectedValue?: Value;
|
||||
onChange?: (value: Value) => void;
|
||||
Component?: string | React.ReactElement<React.HTMLProps<HTMLElement>>;
|
||||
export namespace Radio {
|
||||
export type RadioProps = React.InputHTMLAttributes<HTMLInputElement>;
|
||||
}
|
||||
export const Radio: React.ComponentClass<Radio.RadioProps>;
|
||||
|
||||
export const RadioGroup: React.ComponentClass<RadioGroupProps>;
|
||||
export namespace RadioGroup {
|
||||
export interface RadioGroupProps {
|
||||
name?: string;
|
||||
selectedValue?: Value;
|
||||
onChange?: (value: Value) => void;
|
||||
Component?: string | React.ReactElement<React.HTMLProps<HTMLElement>>;
|
||||
}
|
||||
}
|
||||
export const RadioGroup: React.ComponentClass<RadioGroup.RadioGroupProps>;
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import * as React from 'react';
|
||||
import { Radio, RadioGroup, RadioGroupProps, Value } from "react-radio-group";
|
||||
import { Radio, RadioGroup } from "react-radio-group";
|
||||
|
||||
class ReactRadioGroup extends React.Component<RadioGroupProps> {
|
||||
constructor(props: RadioGroupProps) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
handleChange(value: Value) {
|
||||
class ReactRadioGroup extends React.Component<RadioGroup.RadioGroupProps> {
|
||||
handleChange: RadioGroup.RadioGroupProps['onChange'] = value => {
|
||||
console.log(value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user