Eyas's Blog

Latests Posts

Use trackBy in Angular ngFor Loops and MatTables

Angular Logo (CC-BY 4.0 by Angular Team press Kit: https://angular.io/presskit).

Note: This article was written for the old *ngFor syntax, when trackBy (called track in the new @for syntax) was optional. For much of the same reasons outlined in this post, track in the a @for template is required.

In most cases, TrackByFunction is no longer needed with the new syntax, since the example mentioned in this article could simply be written in the template as:

Read more →

The Joys and Happy Accidents of Branching Out

How helping on a film set led to me down a serendipitous path, publishing a new open source library, and getting an IMDB mention.

About a year ago, a friend asked me—along with some others—to help as extra hands on set filming the second season of an absurdist comedy mini-series she was working on called Look it Up.

Read more →

Learning by Implementing: Observables

Sometimes, the best way to learn a new concept is to try to implement it. With my journey with reactive programming, my attempts at implementing Observables were key to to my ability to intuit how to best use them. In this post, we’ll be trying various strategies of implementing an Observable and see if we can make get to working solution.

I’ll be using TypeScript and working to implement something similar to RxJS in these examples, but the intuition should be broadly applicable.

Read more →

Schema.org Classes in TypeScript: Properties and Special Cases

JSON-LD Logo in Public Domain.

In our quest to model Schema.org classes in TypeScript, we’ve so far managed to model the type hierarchy, scalarDataTypevalues, and enums. The big piece that remains, however, is representing what’s actually inside of the class: it’s properties.

After all, what it means for a JSON-LD literal to have "@type" equal to "Person" is that certain properties — e.g. "birthPlace" or "birthDate", among others — can be expected to be present on the literal. More than their potential presence, Schema.org defines a meaning for these properties, and the range of types their values could hold.

Read more →

Schema.org DataType in TypeScript: Structural Typing Doesn't Cut It

JSON-LD Logo in Public Domain.

Schema.org has a concept of a DataType, things like Text, Number, Date, etc. In JSON-LD, we represent these as strings or numbers, rather than array or object literals. This data could describe the name of a Person, a check-in date and time for a LodgingReservation, a URL of a Corporation, publication date of an Article, etc. As we’ll see, the Schema.org DataType hierarchy is far richer than TypeScript’s type system can accommodate. In this article, we’ll go over the DataType hierarchy and explore how much type checking we can provide.


Read more →

1617