Files
homepage/src/lib/components/do_on_key.js
Alexander Bocken 2feb8355b8 refactor: add TypeScript type annotations to fix implicit 'any' errors
Fixed 12 type errors by adding proper type annotations:

Quick Wins Completed:
- do_on_key.js: Added JSDoc types for KeyboardEvent and function parameters
- randomize.js: Added JSDoc types with generic template for array shuffling
- cookie.js: Added JSDoc types for Request API
- stripHtmlTags.ts: Added TypeScript types for string parameter

Progress: 12/1239 errors fixed (Quick Wins - Category 1 partial)

Created TODO_cleanup.md to track remaining 1227 type errors systematically.
2026-01-05 23:49:02 +01:00

15 lines
257 B
JavaScript

/**
* @param {KeyboardEvent} event
* @param {string} key
* @param {boolean} needsctrl
* @param {() => void} fn
*/
export function do_on_key(event, key, needsctrl, fn){
if(event.key == key){
if(needsctrl && !event.ctrlKey){
return
}
fn()
}
}