fix(checkbox, radio): change event interfaces correctly use TypeScript generics for value (#23044)

Co-authored-by: Liam DeBeasi <liamdebeasi@icloud.com>
This commit is contained in:
Evgeniy
2021-08-03 23:29:53 +03:00
committed by GitHub
parent fbe648406b
commit 8a941fd24c
5 changed files with 16 additions and 16 deletions

View File

@ -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
@ -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

View File

@ -1,5 +1,5 @@
export interface CheckboxChangeEventDetail {
value: any;
export interface CheckboxChangeEventDetail<T = any> {
value: T;
checked: boolean;
}

View File

@ -272,9 +272,9 @@ 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>` |
| `ionChange` | Emitted when the checked property has changed. | `CustomEvent<CheckboxChangeEventDetail<any>>` |
| `ionFocus` | Emitted when the checkbox has focus. | `CustomEvent<void>` |

View File

@ -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;
}

View File

@ -230,8 +230,8 @@ export default defineComponent({
## Events
| Event | Description | Type |
| ----------- | ----------------------------------- | ------------------------------------------ |
| `ionChange` | Emitted when the value has changed. | `CustomEvent<RadioGroupChangeEventDetail>` |
| ----------- | ----------------------------------- | ----------------------------------------------- |
| `ionChange` | Emitted when the value has changed. | `CustomEvent<RadioGroupChangeEventDetail<any>>` |
## Dependencies