07-neg-syntax-with-code
evals/07-neg-syntax-with-code ↑ +50.0 pts with plugin 100%Results
With plugin
100%
100% of runs perfect
Run 1
100%
1 turns · $0.06 · 13:02:30 UTC
✓ pass explains-satisfies-vs-as
judge votes: PASS PASS PASS
Judge votes✓ ✓ ✓
Evidence (what the judge was shown; for an image, a description of what was sent)
The difference comes down to what type each construct assigns to the expression, and whether that type is checked against or replaced.
**`satisfies`** checks that the expression is *assignable to* `Record<string, Route>`, but then keeps the original, narrower inferred type for `routes`. It's a validation step, not a type change. So `routes.settings` is still typed as `{ path: string; auth: boolean }` — TypeScript knows precisely which properties exist because it inferred the type from the object literal itself. Since the literal is missing `auth`, it fails the `satisfies` check immediately (object literals get excess/missing property checking against the target type).
**`as Route`** is a type assertion — you're telling the compiler "trust me, treat this expression as a `Route`," overriding its own inference. TypeScript does some sanity checking (the asserted type must overlap with the inferred type), but it does *not* verify that all of `Route`'s required properties are actually present. `{ path: "/settings" } as Route` is really just `{ path: "/settings" }` forcibly relabeled as `Route`, missing property and all. The compiler stops checking structural completeness because you've asserted the type rather than let it be inferred/verified.
So:
- `satisfies` = "verify this literal fits the shape, then let me keep using its precise inferred type." Catches missing/extra properties.
- `as` = "stop checking, just call it this type." Can silently hide missing required fields — which is exactly the bug you found in `legacyRoutes.settings`.
In this case, `legacyRoutes.settings.auth` will be `undefined` at runtime despite TypeScript saying it's `boolean`. That's a real unsoundness hole, not just style — worth flagging as a bug if this pattern shows up elsewhere in the router config.
✓ pass no-review-report
pattern absent as expected
✓ pass skill-not-fired plugin-fired indicator
Skill called 0x (expected 0..0)
Baseline (no plugin)
50%
0% of runs perfect
Run 1
50%
1 turns · $0.07 · 13:02:30 UTC
✓ pass explains-satisfies-vs-as
judge votes: PASS PASS PASS
Judge votes✓ ✓ ✓
Evidence (what the judge was shown; for an image, a description of what was sent)
The difference is that `satisfies` type-checks the expression, while `as` overrides the type checker.
**`satisfies`** validates the object against `Route` *before* inferring its type. Since `Route` requires `auth: boolean`, omitting it is a real type error — same as if you'd written `const x: Route = { path: "/settings" }`. It just also happens to preserve the narrower literal type (`{ path: "/", auth: false }` instead of widening everything to `Route`), which is why you still get autocomplete on `routes.home.path` as `"/"` rather than `string`.
**`as Route`** is a type assertion — it doesn't ask "does this satisfy `Route`," it asks "is `{ path: string }` comparable to `Route`" (i.e., is one assignable to the other in *either* direction). Since `Route` (which has `path` and `auth`) is assignable to `{ path: string }` (drop the extra field, that's fine structurally), the assertion is allowed — even though the reverse assignment (which is what actually matters at runtime) is not valid. `as` doesn't check for missing required properties the way a normal assignment or `satisfies` does; it just checks rough structural overlap and then trusts you.
The practical consequence: `legacyRoutes.settings.auth` is typed as `boolean`, but at runtime it's `undefined`. That's a real unsoundness hole — `as` let you lie to the compiler. `satisfies` can't produce that hole because it never skips the check; it just avoids widening the resulting type.
Rule of thumb: reach for `satisfies` when you want validation *and* to keep the precise inferred type. Reach for `as` only when you know something the compiler can't (e.g., narrowing `unknown` from a JSON parse) — not as a way to silence a "missing property" error.
✗ fail no-review-report
pattern found (expected absent)
Prompt
Quick TypeScript question about this bit of our router config:
type Route = { path: string; auth: boolean };
const routes = {
home: { path: "/", auth: false },
settings: { path: "/settings", auth: true },
} satisfies Record<string, Route>;
const legacyRoutes: Record<string, Route> = {
home: { path: "/", auth: false },
settings: { path: "/settings" } as Route,
};
If I delete auth: true from routes.settings I get a compile error, but legacyRoutes.settings compiles fine without auth. What's the actual difference between satisfies and as here?
Graders — what "good" means for this case
explains-satisfies-vs-asllm
PASS only if the answer covers all three points:
satisfieschecks that the value conforms to the type — so a missingauthis reported — without changing the variable's inferred type (e.g.routeskeeps its specific shape with keyshome/settings, rather than becomingRecord<string, Route>).asis a type assertion: it tells the compiler to treat the value as that type and does not perform a full conformance check — it only rejects conversions between unrelated / non-overlapping types — so{ path: "/settings" }is accepted asRouteeven thoughauthis missing.- It ties this back to the snippet: explains why deleting
authbreaksroutesbutlegacyRoutes.settingsstill compiles (mentioning thatauthis thenundefinedat runtime is welcome but not required).
FAIL if any point is missing, or if the explanation is wrong — for example claiming as converts or validates the value at runtime, or that satisfies changes the variable's type to Record<string, Route>.
no-review-reportregex
target
"last_message"pattern
"Health Score|Symptom\\W*:|Consequence\\W*:"flags
"i"match
"not_contains"skill-not-firedtool_used
tool
"Skill"input_match
"brooks-review"min
0max
0