Auto-generated tile from GitHub (10 skills)
92
94%
Does it follow best practices?
Impact
92%
1.16xAverage score across 44 eval scenarios
Advisory
Suggest reviewing before use
any Types from a Data Pipeline Utility LibraryA small internal library called datapipe provides utilities for transforming and validating data as it flows through an ETL pipeline. The library was originally written in plain JavaScript and was later converted to TypeScript by adding a .ts extension and any annotations throughout to silence the compiler. As a result, the library provides no meaningful type safety — callers get no IntelliSense, no error-catching, and the TypeScript migration has been more cosmetic than substantive.
The platform team has decided to make the library genuinely type-safe as part of a reliability initiative. They want all any types replaced with accurate, precise types that propagate correctly through the call chain. They also want compile-time tests that verify the types behave as expected — both that correct usage type-checks and that incorrect usage produces a type error.
Your deliverables should include:
any typesworkflow.md document describing the commands you ran during the process (particularly any type-checking commands run before and after changes)Produce the following files:
src/pipeline.ts — refactored source file, fully typedsrc/validators.ts — refactored validators, fully typedtype-tests.ts — compile-time type tests verifying the public API types are correctworkflow.md — document the commands you ran (type-check before, changes made, type-check after)The following files are the current source. Extract them before beginning.
=============== FILE: src/pipeline.ts =============== export type Transformer<T = any> = (input: any) => any
export function createPipeline(transformers: any[]): any { return function runPipeline(input: any): any { return transformers.reduce((acc: any, transform: any) => transform(acc), input) } }
export function map(fn: any): any { return (items: any) => items.map(fn) }
export function filter(predicate: any): any { return (items: any) => items.filter(predicate) }
export function toRecord(keyFn: any): any { return (items: any) => { const result: any = {} for (const item of items) { result[keyFn(item)] = item } return result } }
export function parseJson(raw: any): any { try { return JSON.parse(raw) } catch { return null } }
=============== FILE: src/validators.ts =============== export function isNonNull(value: any): boolean { return value !== null && value !== undefined }
export function hasShape(obj: any, keys: any): boolean { if (typeof obj !== 'object' || obj === null) return false return keys.every((k: any) => k in obj) }
export function assertHasShape(obj: any, keys: any): void {
if (!hasShape(obj, keys)) {
throw new Error(Object missing required keys: ${keys.join(', ')})
}
}
export function getProperty(obj: any, key: any): any { return obj[key] }
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
scenario-33
scenario-34
scenario-35
scenario-36
scenario-37
scenario-38
scenario-39
scenario-40
scenario-41
scenario-42
scenario-43
scenario-44
skills
documentation
fastify
init
linting-neostandard-eslint9
node
nodejs-core
rules
oauth
octocat
snipgrapher