Create an error from multiple errors
94
{
"context": "This criteria evaluates how well the engineer uses the aggregate-error package's TypeScript generic support to create a type-safe error validation system. The focus is on proper usage of the AggregateError class with type parameters to maintain type safety when collecting multiple custom error instances.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Import AggregateError",
"description": "Correctly imports AggregateError from the 'aggregate-error' package (e.g., `import AggregateError from 'aggregate-error'`)",
"max_score": 10
},
{
"name": "Use Generic Type Parameter",
"description": "Uses AggregateError with a generic type parameter that specifies the union of custom error types (e.g., `new AggregateError<ValidationError | RangeError>(errors)`) to ensure type safety",
"max_score": 30
},
{
"name": "Pass Error Array",
"description": "Correctly passes the array of error instances to the AggregateError constructor",
"max_score": 15
},
{
"name": "Return AggregateError Instance",
"description": "Returns the AggregateError instance from the handleValidationErrors function when errors are present",
"max_score": 15
},
{
"name": "Type-Safe Error Access",
"description": "The implementation enables type-safe access to individual errors through the aggregated error's errors property, preserving the custom error types (ValidationError and RangeError)",
"max_score": 20
},
{
"name": "Handle Empty Array",
"description": "Correctly handles the empty array case by returning null without creating an AggregateError instance",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-aggregate-errordocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9