Eyas's Blog

Occasional musings on software development, tech, the Middle East, and anything else.

Software Archives | Page 6 of 7

Schema.org Enumerations in TypeScript

Last time, we talked about modeling the Schema.org class hierarchy in TypeScript . We ended up with an elegant, recursive solution that treats any type Thing as a "@type" -discriminated union of ThingLeaf and all the direct sub-classes of the type. The next challenge in the journey of building TypeScript typings for the Schema.org vocabulary is modeling Enumeration s. Learning from Examples…

Read more →


Modeling Schema.org Schema with TypeScript: The Power and Limitations of the TypeScript Type System

Recently, I published schema-dts ( npm , GitHub ), an open source library that models JSON-LD Schema.org in TypeScript. A big reason I wanted to do this project is because I knew some TypeScript type system features, such as discriminated type unions, powerful type inference, nullability checking, and type intersections, present an opportunity to both model what Schema.org-conformant JSON-LD…

Read more →


About those Side-effects in Observables, an Angular Use Case

When testing a codebase in Angular Ivy, I ran into a bunch of test failures I wasn't seeing before. ExpressionChangedAfterItHasBeenCheckedError s were being thrown around. In debugging these failures, I found that many of them are the results of side-effects in Observables and Observable pipe operations. I happened to describe these earlier in my piece on Observables, Side-effects, and…

Read more →


Observables, Side-effects, and Subscriptions

My previous articles on using AsyncPipe and data refresh patterns in Angular hint at some common anti-patterns dealing with Observables. If there’s any common thread in my advice, it is: delay unpacking an Observable into its scalar types when performing logic you can rewrite as side-effect-free, leaving code with side-effects for subscription callbacks and other downstream logic. My two…

Read more →


Data and Page Content Refresh patterns in Angular

Part of why I recommend using RxJS Observable s all the way through in Angular TypeScript code, and only unpacking them at the closest point to where the UI is declared (often using the | async pipe) , is because it makes other transformations on an Observable available and convenient. Two such examples include retry and refresh logic. Two common reasons to reload/refresh data being…

Read more →


1567