CtrlK
BlogDocsLog inGet started
Tessl Logo

simon/skills

Auto-generated tile from GitHub (10 skills)

92

1.16x
Quality

94%

Does it follow best practices?

Impact

92%

1.16x

Average score across 44 eval scenarios

SecuritybySnyk

Advisory

Suggest reviewing before use

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-18/

Eliminate any Types from a Data Pipeline Utility Library

Problem/Feature Description

A 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:

  1. The refactored source files with no remaining any types
  2. A file of type-level tests
  3. A workflow.md document describing the commands you ran during the process (particularly any type-checking commands run before and after changes)

Output Specification

Produce the following files:

  • src/pipeline.ts — refactored source file, fully typed
  • src/validators.ts — refactored validators, fully typed
  • type-tests.ts — compile-time type tests verifying the public API types are correct
  • workflow.md — document the commands you ran (type-check before, changes made, type-check after)

Input Files

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

README.md

tile.json