Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
Hotkeys API Reference
App Hotkeys API Reference
Key hold & held keys API Reference
Hotkey Recorder API Reference
Normalization & format API Reference
Normalization & format API Reference

assertValidHotkey

ts
function assertValidHotkey(hotkey): void;
function assertValidHotkey(hotkey): void;

Defined in: validate.ts:141

Validates a hotkey and throws an error if invalid. Useful for development-time validation.

Parameters

hotkey

ValidatableHotkey

The hotkey string to validate

Returns

void

Throws

Error if the hotkey is invalid

Example

ts
assertValidHotkey('Mod+S') // OK
assertValidHotkey('') // Throws Error: Invalid hotkey: Hotkey cannot be empty
assertValidHotkey('Mod+S') // OK
assertValidHotkey('') // Throws Error: Invalid hotkey: Hotkey cannot be empty