TSworkingts-evergreen

The satisfies operator

Check the type, keep the value.

satisfies validates a value against a wider type without widening the value — you get the constraint check AND the narrow inferred type, which a plain type annotation throws away.

satisfies vs a plain annotation

TSintro
Press Run to execute

Output localhost 8081 proves checked.port stayed a number after satisfiesport + 1 arithmetic type-checks, whereas the widened annotated.port (string | number) would have errored.