Zod in Angular. Typescript Schema validation library

Using Zod in an Angular project is a great way to introduce runtime validation with static typing. Zod is a TypeScript-first schema declaration and validation library, which complements Angular’s type system and form handling. Why Use Zod in Angular? Type-safe validation Works well with Reactive Forms or standalone services Generates types from schemas automatically Useful for form validation, API response validation, and runtime checks
eraoftech.medium.com/zod-in-angular-8dcefc2a20ec

Nushell

Nushell

A new type of shell

Cross-platform

Nu works on Linux, macOS, BSD, and Windows. Learn it once, then use it anywhere.

Everything is data

Nu pipelines use structured data so you can safely select, filter, and sort the same way every time. Stop parsing strings and start solving problems.

Powerful plugins

It’s easy to extend Nu using a powerful plugin system.

Screenshot showing using the ls command

Nu works with existing data

Nu speaks JSON, YAML, SQLite, Excel, and more out of the box. It’s easy to bring data into a Nu pipeline whether it’s in a file, a database, or a web API:

Screenshot showing fetch with a web API

Nu has great error messages

Nu operates on typed data, so it catches bugs that other shells don’t. And when things break, Nu tells you exactly where and why:

Screenshot showing Nu catching a type error

www.nushell.sh/

Angular – Reload page (and its components) even if on same url

Tested in Angular 19.

Add router to component constructor:

import { Router } from '@angular/router';
...

  public constructor(
    private _router: Router
  ) {}

Navigate and reload page, even if currently on same url

this._router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
  this._router.navigate(['my-page']);
});

Above code navigates to root path without changing url in browser, then navigates to current url /my-page. E.g. “reloads” current page (which has path /mypage).

MVC vs Flux vs Redux: Key Differences Explained

MVC vs Flux vs Redux: Key Differences Explained

Comparing MVC vs Flux vs Redux

1. Architecture

During web application development, we create solutions that address the customers’ needs and solve problems of businesses and users. To achieve this, different architecture patterns and technologies are used. For many years, application designs have revolved around the In the meantime, there have been a series of advanced frameworks like Flux and Redux, in the same vein, which helps you deal with complex applications. We are aware of the increased complexity in apps that multiplies due to the absence of effective design patterns in place. Here we have compared MVC vs Flux vs Redux to help you create effective, sensible and scalable application architecture.

Continue reading “MVC vs Flux vs Redux: Key Differences Explained”

How I conquered multithreading and boosted my code’s speed

I finally understood multithreading — and now my code runs 10x faster. Multithreading used to sound like magic. Or worse — a trap full of race conditions, deadlocks, and endless debugging. But once I broke it down, I realized: It’s just parallel thinking with safety checks. Here’s what helped it all click:
🔹 Threads = multiple tasks running in parallel
🔹 Mutex/locks = only one thread can access shared data at a time
🔹 Race Conditions = when threads clash over shared state
🔹 Deadlocks = when threads wait

Source: How I conquered multithreading and boosted my code’s speed | Ankit Sharma posted on the topic | LinkedIn

Visualizing Angular dependencies

When working on large Angular projqects, managing dependencies between files and modules can become a challenge.

Here are 2 tools to help you visualize dependencies in an Angular project.

Madge – visualizes typescript dependencies

  • https://www.npmjs.com/package/madge
  • Install: npm install -g madge
  • In root folder of project, run:
    npx madge src/main.ts --ts-config tsconfig.json --image ./deps.png

    Above will output the image “deps” in the root of project.
  • Can also be run for any typescript class, e.g. a single component such as:
    npx madge src/app/app.component.ts --ts-config tsconfig.json --image ./deps.png
  • Detect circular dependencies:
    npx madge --circular src/main.ts--ts-config tsconfig.json

  • Detect dead code (code that is never referred to anywhere in your app):
    npx madge --orphans src/main.ts --ts-config tsconfig.json

Compodoc – “The missing documentation tool for Angular..”

https://compodoc.app/

# Install globally compodoc with npm
npm install -g @compodoc/compodoc

# Create a file named tsconfig.doc.json in project root, containing: 
{
"include": ["src/**/*.ts"]
}

# Run compodoc in your project root and serve it on http://127.0.0.1:8080 (will output html based documentation in ./documentation path.
npx compodoc -p tsconfig.doc.json -s

How to update Angular packages minor and patch versions

The simple way

This dont always work but here is a simplistic approach:

  • Delete your node_modules folder and package-lock.json to clear any cached or conflicting dependencies.
  • Make sure all @angular packages are set to the exact same version in package.json (e.g., 19.2.14).
  • Run
npm install
  • If that does not work continue below

Get list of available package updates

Use the npm-check-updates command to get a list of recommended version updates for all npm packages in the project. (E.g. what is the latest available version number for all the packages)

In Angular project root (where the package.json file is) run:
npx npm-check-updates
(is just a dry run wont change anything)

npx npm-check-updates -u
(updates the package.jon file, follow up by npm install to actually install the new versions)

More info: https://www.npmjs.com/package/npm-check-updates

Bump all packages

A recommended approach is to update all “Angular” type of packages first and then any “non Angular packages”.
In Angular project root edit package.json:

Bump all packages with the word “angular” in them to the latest version number (see output from the npm-check-updates command). See this PR diff as an example:
https://dev.azure.com/who-umc/Products/_git/CAT/pullrequest/12413?_a=files&path=/Umc.Cat.Core/src/ClientSPA/package.json
image.png

Then run:
npm install
-> might get dependency errors, cant install

npm install --force
-> forces the install of angular packages
In the above mentioned scenario (just bump angular packages) this works.

As a second step; repeat this for all non-angular packages.

Package.json version interval handling

Whats the difference between ~ and ^ in the acceptable version “interval” value in package.json?
See:
https://stackoverflow.com/questions/22343224/whats-the-difference-between-tilde-and-caret-in-package-json

value desc
~version Approximately equivalent to version, i.e., only accept new patch versions
See npm semver – Tilde Ranges
^version Compatible with version, i.e., accept new minor and patch versions
See npm semver – Caret Ranges
version Must match version exactly
>version Must be greater than version
>=version Must be equal or greater than version
<version Must be lesser than version
<=version Must be equal or lesser than version
1.2.x 1.2.0, 1.2.1, etc., but not 1.3.0
* Matches any version
latest Obtains latest release

The above list is not exhaustive. Other version specifiers include GitHub urls and GitHub user repo’s, local paths and packages with specific npm tags

Official Docs

More tips see this blobpost:
https://www.hostingadvice.com/how-to/update-npm-packages/

A useful npm command for showing peer dependencies of 1 level down:

npm ls --depth=1

(Vary the depth number to show deeper dependencies)