From 085789a0e15f506caacc5372eea59a7e8ca6a45b Mon Sep 17 00:00:00 2001 From: Duong Tran Date: Mon, 27 Aug 2018 11:54:01 +1000 Subject: [PATCH] fix onChange definition toggle button group --- .../lib/ToggleButtonGroup.d.ts | 57 +++++++++---------- ...-bootstrap-individual-components-tests.tsx | 16 +++++- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/types/react-bootstrap/lib/ToggleButtonGroup.d.ts b/types/react-bootstrap/lib/ToggleButtonGroup.d.ts index 1c3f6f4020..2c40c6553f 100644 --- a/types/react-bootstrap/lib/ToggleButtonGroup.d.ts +++ b/types/react-bootstrap/lib/ToggleButtonGroup.d.ts @@ -3,37 +3,36 @@ import { ButtonGroup } from 'react-bootstrap'; import { Omit } from "../index"; declare namespace ToggleButtonGroup { - interface BaseProps { - /** - * You'll usually want to use string|number|string[]|number[] here, - * but you can technically use any|any[]. - */ - defaultValue?: any; - /** - * You'll usually want to use string|number|string[]|number[] here, - * but you can technically use any|any[]. - */ - value?: any; - } + interface BaseProps { + /** + * You'll usually want to use string|number|string[]|number[] here, + * but you can technically use any|any[]. + */ + defaultValue?: any; + /** + * You'll usually want to use string|number|string[]|number[] here, + * but you can technically use any|any[]. + */ + value?: any; + } - interface RadioProps { - /** Required if `type` is set to "radio" */ - name: string; - type: "radio"; - onChange?(value: any): void; - } + interface RadioProps { + /** Required if `type` is set to "radio" */ + name: string; + type: "radio"; + onChange?(value: any): void; + } - interface CheckboxProps { - name?: string; - type: "checkbox"; - onChange?(values: any[]): void; - } - - export type ToggleButtonGroupProps = BaseProps - & (RadioProps | CheckboxProps) - & Omit, "defaultValue" | "type" | "value"> - & Omit, "defaultValue" | "type" | "value" | "onChange">; + interface CheckboxProps { + name?: string; + type: "checkbox"; + onChange?(values: any[]): void; + } + export type ToggleButtonGroupProps = BaseProps + & (RadioProps | CheckboxProps) + & Omit + & Omit, "defaultValue" | "type" | "value" | "onChange">; } -declare class ToggleButtonGroup extends React.Component { } +declare class ToggleButtonGroup extends React.Component { } export = ToggleButtonGroup; diff --git a/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx b/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx index 8c4237d22b..a50e5176f1 100644 --- a/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx +++ b/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx @@ -210,8 +210,20 @@ export class ReactBootstrapIndividualComponentsTest extends React.Component { - - + { }} + /> + { }} + />