Urgent.News

What's breaking now, across thousands of outlets.

Tech

Comparing satisfies, type annotations, and assertions through compiler output

Use satisfies when a configuration value should meet a type while its individual properties remain convenient to use. Two common shortcuts are misleading, though: that it can never affect inference, and that it always rejects extra keys. The comparison uses the same object under a type annotation, satisfies , and as , with emitted declarations and diagnostics as evidence. For this display…

Satisfies, type annotations, and assertions all serve distinct purposes when working with TypeScript, and their compiler outputs illustrate those differences. The experiment, conducted on September 11, 2026, used Node.js 24.15.0, TypeScript 7.0.2, and macOS arm64 to compare the three concepts.

The first example defined a type `Notices` with properties `ready` and `waiting`, which could be either a string or an array of numbers. Three variables were then created: `annotated`, `checked`, and `asserted`, each using a different approach to specifying the type of the object. While `annotated` used type annotations, `checked` employed `satisfies`, and `asserted` utilized an assertion.

When accessing the `ready` property of `checked`, the compiler successfully called the `toUpperCase()` method, indicating that the property exists and is of the expected type. However, attempting the same operation on `annotated` triggered a type error, as the compiler recognized that `ready` could also be an array of numbers, not just a string.

The emitted declarations revealed that `checked` retained the types of individual properties, while `annotated` and `asserted` shared the same `Notices` type. This behavior highlights the usefulness of `satisfies` when a configuration needs compatibility checks without requiring additional narrowing when working with specific properties.

Next, the experiment explored assertions with a similar `Notices` type. When creating a value object with only the `ready` property, the compiler did not detect the missing `waiting` property when using an assertion. However, switching to `satisfies` produced a type error for the missing property, demonstrating that assertions are more permissive than `satisfies` in terms of required properties.

Finally, the experiment showcased the impact of context on inference. Using `as const` on an object with `enabled` and `count` properties resulted in those properties being inferred as `true` and `number`, respectively. When employing `frozenType` with `as const`, the `enabled` property became a readonly `true`, and `count` became a readonly `1`. This showcases how contextual information can lead to different inferred types for the same object.

In conclusion, the experiment revealed that `satisfies` is valuable for compatibility checks, type annotations offer explicit property types, and assertions provide a more permissive approach when certain properties are optional. Understanding these distinctions and their compiler outputs is crucial for effectively working with TypeScript's type system.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Making images wobble in the browser: masks, spring motion and local GIF/MP4/WebM export

Disclosure: I made Purupuru Maker , the browser tool this post is based on. "Purupuru" (ぷるぷる) is the Japanese onomatopoeia for something soft and jiggly, like pudding, cheeks or a jelly cat.

  • Purupuru Maker creates wobbling animations in browser
  • Image decoded into memory, mask applied for movement
  • Animation exported as GIF, MP4, or WebM using WebCodecs

Installing ReSkate for skate. on PC: a version-aware setup and troubleshooting guide

Disclosure: I run reskatemods.com , an independent index of ReSkate maps, mods and install notes. I'm not affiliated with the ReSkate authors (Dingo-Shenanigans), EA or Full Circle.

  • ReSkate is a free GPL-3.0 mod platform for Skate PC version
  • Installation guide covers ReSkate 2.0.7, latest version as of Oct 2026
  • Version matching required for multiplayer and offline play

My AI visibility score was 29.2. Here is what the one number was hiding

The daily run of my AI citation tracker finished on 21 October with a blended score of 29.2. On its own that reads like a mediocre week.

  • My AI citation tracker posted a blended score of 29.2 on October 21st
  • The "Direct" bucket accounted for 88.9% of the points
  • Genre recommendation bucket contributed 50.0% to the total score

cosskill update: attach screenshots to your practice conversations

Quick update for anyone using cosskill to rehearse high-stakes conversations — you can now attach screenshots to a practice conversation.

  • New feature allows attaching screenshots to practice conversations
  • AI persona uses image for context in simulated dialogue
  • Free tier offers five messages per day with no sign-up required

More from Thursday 22 October →