November 2024 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Category Archives: TypeScript
TypeScript: Make stricter Required
When you have a type with optional props, then to make those props required you can use Required like so:
BrowserPriorityTimers npm module
I’ve prepared npm package with the BrowserPriorityTimers class. It gives you ability to use timers that will not be throttled by the browser. This maybe useful at times when you want to keep your timers execute without interruption even when … Continue reading
Posted in npm modules, TypeScript
Tagged npm, timers, TypeScript, web-workers
Comments Off on BrowserPriorityTimers npm module
TypeScript: Add typing to the lodash entries helper
This is a followup post to the other one where we’ve added types to the lodash keys helper. This time we will add types to the entries helper, which is an alias to the toPairs helper, where we can also … Continue reading
Posted in TypeScript
Tagged TypeScript
Comments Off on TypeScript: Add typing to the lodash entries helper
TypeScript: Add typing to the lodash keys helper
With lodash (Version 4.17.21 at time of writing) and @types/lodash (Version 4.14.191 at time of writing) using the keys helper will lose the type information of the given object.
TypeScript: custom type guards
Type guards are tools for type narrowing in TypeScript. You may have used some of those features e.g. typeof, instanceof, in etc. already but I want to describe writing guards for types created by you.