Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungThe Homelab Is the New Resume(21.09.2026 um 00:29 Uhr)
Sichere ProgrammierungPerl 🐪 Weekly #791 - The Dark Side is here!(21.09.2026 um 00:44 Uhr)
Sichere Programmierungbro.js v3.0.0 – What’s new(21.09.2026 um 00:44 Uhr)
Sichere ProgrammierungFour bugs my test suite couldn't catch(21.09.2026 um 00:49 Uhr)
Sichere ProgrammierungAutomating Deployment with Github Actions(21.09.2026 um 00:49 Uhr)
Linux Tipps & HardeningKernel prepatch 7.3-rc4(21.09.2026 um 00:52 Uhr)
IT NachrichtenHow to use Xbox mode on your Windows PC(21.09.2026 um 00:30 Uhr)
Sichere ProgrammierungThe Homelab Is the New Resume(21.09.2026 um 00:29 Uhr)
Sichere ProgrammierungPerl 🐪 Weekly #791 - The Dark Side is here!(21.09.2026 um 00:44 Uhr)
Sichere Programmierungbro.js v3.0.0 – What’s new(21.09.2026 um 00:44 Uhr)
Sichere ProgrammierungFour bugs my test suite couldn't catch(21.09.2026 um 00:49 Uhr)
Sichere ProgrammierungAutomating Deployment with Github Actions(21.09.2026 um 00:49 Uhr)
Linux Tipps & HardeningKernel prepatch 7.3-rc4(21.09.2026 um 00:52 Uhr)
IT NachrichtenHow to use Xbox mode on your Windows PC(21.09.2026 um 00:30 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Diving into Type System behind Angular Signal Inputs

Reagiere als Erste:r — dein Feedback zählt!

Original version of this writing has been published as a twitter thread. However, I was convinced by @eneajaho to convert it into a blogpost 😎. I decided to leave the original form: quick, easy-going and concise.

As you may know, Signal Inputs are coming to Angular in mid January 2024 in version 17.1. But we can actually play with them already, or at least, take a look at their almost public API. In this post we'll take a deep dive into the type design of Signal Inputs internals, its consequences, and a lot of examples of Signal Inputs usage.

Demo code

We're gonna expose what the Angular Team has hidden from us...

🪄 the trick is:

import { ɵinput as input } from '@angular/core';

don't do this at home 😈!

Following stackblitz allows you to see Signal Input declarations. Note that there's no Signal Input implementation within angular as of now (v17.1.0-next.5), so we'll focus on declarations/public API only.

ToC

🛠️ first - examples
🥩 then - internals

We'll analyze the examples from above stackblitz one by one, and later we'll analyze the internals & types underneath.

Examples

We'll start with lots of examples. Take a look at the first one:

🔍 initial value is used to infer the input's type, same as with ordinary signals:

signal usage screen

⚠️ Input Signals are READONLY, which makes sense, since it's the parent component who can put new values (via templates) into the input signal, not us 😉

signal usage screen

One of my favorite design decisions:
💪 taking advantage of (1) #typescript's possibilities and (2) applying best solutions from other frameworks. In this case: from React

💜🩷💜 love it 🩷💜🩷

signal usage screen

Less exciting - and IMHO it should be avoided as much as possible (since it decreases readability and the understanding of how components exchange data) - aliasing is allowed:

📡 aliased name is used by parent to pass the data
🔐 the prop name is used internally (obviously)

signal usage screen

Another logical design decision:
💪 since an input is REQUIRED, passing initial value makes no sense 😉 so it's removed from the signature

signal usage screen

Here the initialValue parameter is removed from the function (overload) signature. Or to be more precise - it's never added (never allowed) to be there 😉

So, technically speaking, TypeScript would try to pass your initial as options object which obviously fails.

signal internals code

And one more example - transform is allowed only when passing both ReadT and WriteT type parameters. More on this later...

signal usage screen

Internals

Now let's see 🍖 some internals 🥩

signal internals code

To get a broad overview of the direction, you might be interested in taking a look at the ➡️ Angular Team's Sub-RFC 3: Signal-based Components which deals with, more or less, how to make use of signals in Angular Components. Also, you can ➡️ take a look at the code itself. Anyway, let's dive into the internals!

We've got 2 new signal symbols:

signal internals code

it's the same usecase, as with the former unique Signal symbol - it allows to restrict compatibility across different (input) signals.

For instance:
✅ one can assign the InputSignal<number, number> to an ordinary Signal<number>

signal internals code

Proof:

  1. need to make ordinary signal READONLY so that TS compares 2 readonly signals (input signals are READONLY)

  2. where a string signal is expected, a string input signal is acceptable, since it has all required (needed) properties.

  3. ❌ but the other way round it fails, since an ordinary string signal doesn't have the brand read/write signals.

signal compatibility proof code

Reassigning signals, however, is not going to be anyhow common 😉. But the Angular compiler also makes use of the symbols internally.

Now, this is where we get the signals API from. There's a completely separate implementation for optional and required inputs. It's just exposed as a convenient API:

s1 = input()
s2 = input.required()

signal internals code

The sad thing, however, is that currently we cannot see its runtime.

(disclaimer: as mentioned above, ng v17.1 is expected very soon, this analysis uses v17.0.1-next.5).

signal internals code

Now let's take a look back at input transform:

signal usage code

However, you might be wondering what the heck is going on with this function overload and the strange declaration at the bottom:

Image description

First of all, if we pass <ReadT> only, we can't pass the input transform (that's the same as with current

@Input
({ transform: ... })

signal internals code

However, if we pass both <ReadT, WriteT>, we can additionally pass the transform. Note that:

  • ReadT is the expression type you want to use inside your component
  • WriteT is the expression type that is passed from outside

signal internals code

Another example:

signal usage code

Going back to our nice declaration 🥴 let's focus on inputFunction first:

signal internals code

It has 3 overloads on its own:

  • take no initial value and extend inner value with undefined
  • take the initial value with ReadT type param only (opts WITHOUT transform)
  • take the initial value with both ReadT, WriteT type params (opts WITH transform)

All usecases seen before 😎💪

signal internals code

All in all we've got 3 overloads for the prop = input() (optional)
... and 2 overloads for the prop = input.required() (required)

signal internals code

Phew 😅 that was quite a lot. Hope you enjoyed that.

Remember you can play with it on this stackblitz. It includes the code of all examples.

Follow me on twitter for more frontend (js, ts, react, angular etc.) deep dives!

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Diving into Type System behind Angular Signal Inputs

Thematisch verwandte Begriffe: Diving, into, Type, System · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94084 | Suricata before 8.0.7 has an Http2ThreadMultiBuf use-after-free when a t…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick