Closed w01fgang closed 2 months ago
I'm on "@spotlightjs/spotlight": "^2.3.2", and I see this error every time I select an option in an input with a native browser autocompletion.
No errors
The error happens in this part of the code, at key.toLowerCase()
key.toLowerCase()
function uR(e, t, n = !1) { P.useEffect(() => { function r(i) { n || i.stopPropagation(), e.every( (s) => s in i ? i[s] : i.key.toLowerCase() === s.toLowerCase() ) && t(); } return window.addEventListener("keyup", r), () => window.removeEventListener("keyup", r); }, [e, t, n]); }
Actually, I found the bug here. I'm wondering why TS is silent, there's no key in e in the second part of the ternary.
key
e
keys.every((key: string) => key in e ? e[key as keyof KeyboardEvent] : e.key.toLowerCase() === key.toLowerCase(), )
It should be like this, because there's no key in the event:
keys.every((key: string) => key in e && e[key as keyof KeyboardEvent], )
Environment
I'm on "@spotlightjs/spotlight": "^2.3.2", and I see this error every time I select an option in an input with a native browser autocompletion.
Steps to Reproduce
Expected Result
No errors
Actual Result
The error happens in this part of the code, at
key.toLowerCase()
Actually, I found the bug here. I'm wondering why TS is silent, there's no
key
ine
in the second part of the ternary.It should be like this, because there's no key in the event: