Designs complex generic types, refactors `any` types to strict alternatives, creates type guards and utility types, and resolves TypeScript compiler errors. Use when the user asks about TypeScript (TS) types, generics, type inference, type guards, removing `any` types, strict typing, type errors, `infer`, `extends`, conditional types, mapped types, template literal types, branded/opaque types, or utility types like `Partial`, `Record`, `ReturnType`, and `Awaited`.
87
95%
Does it follow best practices?
Impact
76%
1.16xAverage score across 5 eval scenarios
Passed
No known issues
{
"context": "Tests whether the agent implements nominal/brand types using the phantom property pattern and correctly distinguishes between type predicates and assertion functions, including the function-keyword requirement for assertions.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Opaque pattern",
"description": "Defines an Opaque or Brand generic helper type using intersection with a phantom brand property (e.g., `TValue & { __brand: TBrand }` or similar)",
"max_score": 12
},
{
"name": "Multiple opaque types",
"description": "Defines at least two distinct opaque types using the helper (e.g., UserId and PostId, or ValidEmail and ValidPassword)",
"max_score": 8
},
{
"name": "Assertion function syntax",
"description": "Assertion functions (those with `asserts value is T` return type) are declared using the `function` keyword, NOT as arrow function constants",
"max_score": 15
},
{
"name": "Type predicate syntax",
"description": "Type guard predicates (those returning `value is T`) correctly annotate the return type — not just `boolean`",
"max_score": 10
},
{
"name": "Both predicate and assertion present",
"description": "At least one type predicate function AND at least one assertion function are implemented",
"max_score": 10
},
{
"name": "Async utility types",
"description": "When extracting the return type of an async function, uses `Awaited<ReturnType<typeof fn>>` (not bare `ReturnType<typeof fn>`)",
"max_score": 10
},
{
"name": "typeof with utility types",
"description": "Uses `typeof` before runtime function names when passing them to utility types like `Parameters<>` or `ReturnType<>`",
"max_score": 8
},
{
"name": "Type theory explanation",
"description": "Written explanation distinguishes structural typing from nominal typing and explains why the phantom brand property creates incompatibility",
"max_score": 10
},
{
"name": "Before/after comparison",
"description": "Shows a before/after code comparison illustrating how the unbranded version allowed unsafe assignments and the branded version prevents them",
"max_score": 10
},
{
"name": "Type tests",
"description": "Includes at least two type-level tests (using `// @ts-expect-error` or explicit type assertions) verifying that incompatible opaque types are rejected",
"max_score": 7
}
]
}