@@ -38,7 +38,7 @@ export default class Autocomplete {
3838 this . results . addEventListener ( 'combobox-commit' , this . onCommit )
3939 }
4040
41- destroy ( ) {
41+ destroy ( ) : void {
4242 this . input . removeEventListener ( 'keydown' , this . onKeydown )
4343 this . input . removeEventListener ( 'focus' , this . onInputFocus )
4444 this . input . removeEventListener ( 'blur' , this . onInputBlur )
@@ -47,7 +47,7 @@ export default class Autocomplete {
4747 this . results . removeEventListener ( 'combobox-commit' , this . onCommit )
4848 }
4949
50- onKeydown ( event : KeyboardEvent ) {
50+ onKeydown ( event : KeyboardEvent ) : void {
5151 if ( event . key === 'Escape' && this . container . open ) {
5252 this . container . open = false
5353 event . stopPropagation ( )
@@ -64,19 +64,19 @@ export default class Autocomplete {
6464 }
6565 }
6666
67- onInputFocus ( ) {
67+ onInputFocus ( ) : void {
6868 this . fetchResults ( )
6969 }
7070
71- onInputBlur ( ) {
71+ onInputBlur ( ) : void {
7272 if ( this . interactingWithList ) {
7373 this . interactingWithList = false
7474 return
7575 }
7676 this . container . open = false
7777 }
7878
79- onCommit ( { target} : Event ) {
79+ onCommit ( { target} : Event ) : void {
8080 const selected = target
8181 if ( ! ( selected instanceof HTMLElement ) ) return
8282 this . container . open = false
@@ -85,23 +85,23 @@ export default class Autocomplete {
8585 this . container . value = value
8686 }
8787
88- onResultsMouseDown ( ) {
88+ onResultsMouseDown ( ) : void {
8989 this . interactingWithList = true
9090 }
9191
92- onInputChange ( ) {
92+ onInputChange ( ) : void {
9393 this . container . removeAttribute ( 'value' )
9494 this . fetchResults ( )
9595 }
9696
97- identifyOptions ( ) {
97+ identifyOptions ( ) : void {
9898 let id = 0
9999 for ( const el of this . results . querySelectorAll ( '[role="option"]:not([id])' ) ) {
100100 el . id = `${ this . results . id } -option-${ id ++ } `
101101 }
102102 }
103103
104- fetchResults ( ) {
104+ fetchResults ( ) : void {
105105 const query = this . input . value . trim ( )
106106 if ( ! query ) {
107107 this . container . open = false
@@ -132,13 +132,13 @@ export default class Autocomplete {
132132 } )
133133 }
134134
135- open ( ) {
135+ open ( ) : void {
136136 if ( ! this . results . hidden ) return
137137 this . combobox . start ( )
138138 this . results . hidden = false
139139 }
140140
141- close ( ) {
141+ close ( ) : void {
142142 if ( this . results . hidden ) return
143143 this . combobox . stop ( )
144144 this . results . hidden = true
0 commit comments