Author Archives: Łukasz Grela

TypeScript: Make stricter Required

When you have a type with optional props, then to make those props required you can use Required like so:

Posted in TypeScript | Tagged , , | Leave a comment

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 , , , | 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 | 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.

Posted in TypeScript | Tagged | 1 Comment

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.

Posted in TypeScript | Tagged , | Comments Off on TypeScript: custom type guards