Take in an API response with both types and a runtime check
Writing types protects you at compile time, but a type annotation cannot protect a value that came from outside. You build a type guard that narrows from unknown, rejecting the rows that do not fit while counting them.