Skip to content

Commit

Permalink
docs(Autocomplete): update Autocomplete event typing (#1969)
Browse files Browse the repository at this point in the history
Co-authored-by: CokaKoala <31664583+AdrianGonz97@users.noreply.github.com>
  • Loading branch information
rakuzen25 and AdrianGonz97 authored Aug 29, 2023
1 parent b37a39f commit 81348f6
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,30 @@
let inputChip = '';
let inputChipList: string[] = ['vanilla', 'chocolate'];
function onDemoSelection(event: any): void {
function onDemoSelection(event: CustomEvent<AutocompleteOption>): void {
console.log(event.detail);
inputDemo = event.detail.label;
}
function onAllowedlistSelect(event: any): void {
function onAllowedlistSelect(event: CustomEvent<AutocompleteOption>): void {
console.log(event.detail);
inputAllowlist = event.detail.label;
}
function onDeniedlistSelect(event: any): void {
function onDeniedlistSelect(event: CustomEvent<AutocompleteOption>): void {
console.log(event.detail);
flavorDenylist = [event.detail.value];
flavorDenylist = [event.detail.value as string];
}
function onInputChipSelect(event: any): void {
function onInputChipSelect(event: CustomEvent<AutocompleteOption>): void {
console.log('onInputChipSelect', event.detail);
if (inputChipList.includes(event.detail.value) === false) {
inputChipList = [...inputChipList, event.detail.value];
if (inputChipList.includes(event.detail.value as string) === false) {
inputChipList = [...inputChipList, event.detail.value as string];
inputChip = '';
}
}
function onPopupDemoSelect(event: any): void {
function onPopupDemoSelect(event: CustomEvent<AutocompleteOption>): void {
inputPopupDemo = event.detail.label;
}
</script>
Expand Down Expand Up @@ -115,7 +115,7 @@ const flavorOptions: AutocompleteOption[] = [
<CodeBlock
language="ts"
code={`
function onFlavorSelection(event: any): void {
function onFlavorSelection(event: CustomEvent<AutocompleteOption>): void {
inputDemo = event.detail.label;
}
`}
Expand Down

0 comments on commit 81348f6

Please sign in to comment.