#JavaScript
Yargs 18 Pitfalls
Upgrading Yargs from version 17 to 18 in a TypeScript project using Jest turned out to be a bit of a nightmare. The release notes for Yargs 18.0.0 include the line “yargs is now ESM first” — a seemingly small change that can cause major headaches. In this blog post, we’ll take a closer look at what that means and how to deal with it.
Hidden Quirks of JavaScript `for...in` Loops
The C-style three-expression for loop in JavaScript is often viewed as old school or awkward beginner style. Some developers automatically use a for...of, foreach, or for...in statement instead. But the latter has a subtle pitfall that can lead to unexpected behaviour.
Dynamic Angular Configuration
Angular apps traditionally rely on static configuration through environment files, necessitating separate builds for each environment ‐ a cumbersome process in practical scenarios. In this blog post, we describe an alternative, where configuration is loaded dynamically at runtime, streamlining development and enhancing flexibility. As an additional benefit, we will validate the configuration against a schema and add type-safety to it.
Standalone Angular Tour Of Heroes
The popular Angular Tutorial Tour of Heroes currently does not work as described with recent Angular versions (Angular 18) because the Angular command-line tool now creates a standalone Angular app by default. You could avoid these problems by creating a non-standalone app but it is also quite instructive to just fix the problems yourself and stick with the standalone version.