Episode 24/30: Signal Store Release, TypeScript & Node.js, Mark Thompson on Angular

ng_news

ng-news

Posted on August 2, 2024

Episode 24/30: Signal Store Release, TypeScript & Node.js, Mark Thompson on Angular

NgRx Signal Store, now in its stable version. Node.js will soon support TypeScript in an experimental mode. Mark Thompson, in an interview for the Angular Masters Podcast, highlighted on why Angular should be used.

NgRx Signal Store

NgRx Global and Component Store are the most used state management libraries in Angular. The NgRx Signal Store, a third state management library, has been released as a stable version and is, therefore, out of developer preview, where it has been since October last year.

The Signal Store builds upon Angular's Signals, is functional-based, and allows for easy-to-write custom extensions.

The release adds features such as encapsulation, override protection, and the possibility of tracking changes to a state that would be dropped by the glitch-free effect.

With a download rate of more than 50k per week, it is already in the upper half of the existing state management libraries. However, it still has some way to go to reach the stats of the NgRx global store, which is at 600k.

Node.js runs TypeScript

Node.js will support TypeScript. That's what was posted quite often on social media last week.

The full story is that Node.js will have an experimental mode, where it can remove the type information from a TypeScript file and execute what's left: JavaScript.

So, no type-checking, which we usually get from the TypeScript compiler, will take place. If you want type checks, then your IDE, CI, or some other tooling needs to do them, not the runtime.

A sandbox to try it out is available at:

module: add --experimental-strip-types #53725

Moderation Note: This PR has been posted on several social network platforms and thus attracts a lot of mostly off-topic comments.

If you've used this feature and ran into issues or have specific feedback to provide - please open a new issue https://github.com/nodejs/node/issues/new/choose


It is possible to execute TypeScript files by setting the experimental flag --experimental-strip-types. Node.js will transpile TypeScript source code into JavaScript source code. During the transpilation process, no type checking is performed, and types are discarded.

Roadmap

Refs: https://github.com/nodejs/loaders/issues/217

Motivation

I believe enabling users to execute TypeScript files is crucial to move the ecosystem forward, it has been requested on all the surveys, and it simply cannot be ignored. We must acknowledge users want to run node foo.ts without installing external dependencies or loaders.

There is a TC39 proposal for type annotations

Why type stripping

Type stripping as the name suggest, means removing all the types, transform the input in a JavaScript module.

const foo: string = "foo";
Enter fullscreen mode Exit fullscreen mode

Becomes:

const foo = "foo";
Enter fullscreen mode Exit fullscreen mode

Other runtimes also perform transformation of some TypeScript only features into JavaScript, for example enums, which do not exists in JavaScript. At least initially in this PR no trasformation is performed, meaning that using Enum, namespaces etc... will not be possible.

Why I chose @swc/wasm-typescript

Because of simplicity. I have considered other tools but they require either rust or go to be added to the toolchain. @swc/wasm-typescript its a small package with a wasm and a js file to bind it. Swc is currently used by Deno for the same purpose, it's battle tested. In the future I see this being implemented in native layer. Massive shoutout to @kdy1 for releasing a swc version for us.


⚠️ Refer to the PR changes in typescript.md for implementation details and limitations.

Mark Thompson on Angular

Dariusz Kalbarczyk recently interviewed Mark Thompson, Angular’s Developer Relations Engineer. Among various insightful discussions, Mark shared strategies on how to convince developers to start using Angular.

According to Mark, Angular excels when developers need to switch between different projects. Its structured architecture and design principles help developers quickly find their way around, making transitions smoother and more efficient.

💖 💪 🙅 🚩
ng_news
ng-news

Posted on August 2, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related