Skip to content

Commit

Permalink
fix(checkbox, radio): change event interfaces correctly use TypeScrip…
Browse files Browse the repository at this point in the history
…t generics for value (#23044)

Co-authored-by: Liam DeBeasi <liamdebeasi@icloud.com>
  • Loading branch information
osben and liamdebeasi committed Aug 3, 2021
1 parent fbe6484 commit 8a941fd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ ion-checkbox,prop,mode,"ios" | "md",undefined,false,false
ion-checkbox,prop,name,string,this.inputId,false,false
ion-checkbox,prop,value,string,'on',false,false
ion-checkbox,event,ionBlur,void,true
ion-checkbox,event,ionChange,CheckboxChangeEventDetail,true
ion-checkbox,event,ionChange,CheckboxChangeEventDetail<any>,true
ion-checkbox,event,ionFocus,void,true
ion-checkbox,css-prop,--background
ion-checkbox,css-prop,--background-checked
Expand Down Expand Up @@ -867,7 +867,7 @@ ion-radio-group,none
ion-radio-group,prop,allowEmptySelection,boolean,false,false,false
ion-radio-group,prop,name,string,this.inputId,false,false
ion-radio-group,prop,value,any,undefined,false,false
ion-radio-group,event,ionChange,RadioGroupChangeEventDetail,true
ion-radio-group,event,ionChange,RadioGroupChangeEventDetail<any>,true

ion-range,shadow
ion-range,prop,color,string | undefined,undefined,false,true
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/checkbox/checkbox-interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

export interface CheckboxChangeEventDetail {
value: any;
export interface CheckboxChangeEventDetail<T = any> {
value: T;
checked: boolean;
}
10 changes: 5 additions & 5 deletions core/src/components/checkbox/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ export default defineComponent({

## Events

| Event | Description | Type |
| ----------- | ---------------------------------------------- | ---------------------------------------- |
| `ionBlur` | Emitted when the checkbox loses focus. | `CustomEvent<void>` |
| `ionChange` | Emitted when the checked property has changed. | `CustomEvent<CheckboxChangeEventDetail>` |
| `ionFocus` | Emitted when the checkbox has focus. | `CustomEvent<void>` |
| Event | Description | Type |
| ----------- | ---------------------------------------------- | --------------------------------------------- |
| `ionBlur` | Emitted when the checkbox loses focus. | `CustomEvent<void>` |
| `ionChange` | Emitted when the checked property has changed. | `CustomEvent<CheckboxChangeEventDetail<any>>` |
| `ionFocus` | Emitted when the checkbox has focus. | `CustomEvent<void>` |


## Shadow Parts
Expand Down
8 changes: 4 additions & 4 deletions core/src/components/radio-group/radio-group-interface.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

export interface RadioGroupChangeEventDetail {
value: any;
export interface RadioGroupChangeEventDetail<T = any> {
value: T;
}

export interface RadioChangeEventDetail {
value: any;
export interface RadioChangeEventDetail<T = any> {
value: T;
checked: boolean;
}
6 changes: 3 additions & 3 deletions core/src/components/radio-group/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ export default defineComponent({

## Events

| Event | Description | Type |
| ----------- | ----------------------------------- | ------------------------------------------ |
| `ionChange` | Emitted when the value has changed. | `CustomEvent<RadioGroupChangeEventDetail>` |
| Event | Description | Type |
| ----------- | ----------------------------------- | ----------------------------------------------- |
| `ionChange` | Emitted when the value has changed. | `CustomEvent<RadioGroupChangeEventDetail<any>>` |


## Dependencies
Expand Down

0 comments on commit 8a941fd

Please sign in to comment.