Handling keyboard shortcuts on non-Latin alphabet layouts

Suppose you build a desktop app and add keyboard shortcuts such as Ctrl+S to save the document. It’s pretty straightforward to wire it for keyboard layouts that are based on the Latin script. How would you go about handling keyboard shortcuts on non-Latin layouts such as Cyrillic or Greek? Languages that do not use Latin … Read more

Adding type safety to object IDs in TypeScript

I was creating a type for an options object of a function, one of the options properties would accept an ID of the item (string based UUID) or a special value, i.e. ‘currentNode’. Initially I would come up with something like this: Try It There are 2 problems with this approach: type NodeId = string … Read more

TypeScript and NPM package.json exports the 2024 way

The package.json exports field is the new, official standard for declaring package entry points. Using it with TypeScript is not so obvious and easy to get wrong in a way where you only find out via an issue report from a user of your library. Let’s find out how to make package.json exports work with … Read more

TypeScript Index Signatures – Everything You Have to Know

It’s not uncommon to get an Index signature for type ‘string’ is missing in type ‘A’ error in TypeScript. The error message is pretty straightforward to understand… once you know what an index signature is in the first place – so what are TypeScript index signatures exactly and what are the non-obvious gotchas? An index … Read more