Sponsored links
JavaScript/TypeScript

TypeScript Utility types defined with infer keyword

infer keyword is one of the difficult features that TypeScript offers. Some utility types use infer keyword, so let's le...
JavaScript/TypeScript

TypeScript How to set a default value with Interface

This page shows 3 ways to set default values to an interface. Using Spread Operator is an easy way. You can also define the default values in a function. An advanced way is to create a class for it.
JavaScript/TypeScript

node-serialport throws “File not found” error for a certain device when using USB-COM interface

I needed to use node-serialport to use a scanner for my project. I have two scanners. One of them works fine but another...
JavaScript/TypeScript

Implement IoT State Machine Transition By State Pattern In TypeScript

In my project, my team needed to implement State machine. One of the developers implemented it by using many if-else but...
JavaScript/TypeScript

A good way to write our own Node-RED node for the testability

I have used Node-RED for more than 3 years for my working project. I came up with a good idea to write our own node for ...
JavaScript/TypeScript

Object Type Check By User Defined Type Guard with Record Type

I wrote the following article before. When we want to access a property of an object, we must somehow tell the compiler ...
JavaScript/TypeScript

TypeScript input validation by Method Decorators

While I read a book on API Design Patterns, I found decorators were used in the examples. It looks like this. @get("reso...
Recommendations

Thumb orthosis supports Tendonitis/Arthritis to relieve the pain

I have tendonitis maybe in my both thumb. A programmer could have this problem because we use our fingers a lot. I've ha...
JavaScript/TypeScript

Top-Level function cannot be stubbed if it is exported by an asterisk

A top-level function is not a part of an object. If we need to stub it, we need to have an object that has the target fu...
JavaScript/TypeScript

TS2322 error when trying to add a property to an anonymous object

To solve TS2322 or TS7053 error, you need to define the data type correctly. Let's define Optional/Mandatory type to omit some properties.
Sponsored links