CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-io-ts

tessl install tessl/npm-io-ts@2.2.0

TypeScript runtime type system for IO decoding/encoding

Agent Success

Agent success rate when using this tile

72%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.14x

Baseline

Agent success rate without this tile

63%

task.mdevals/scenario-3/

Product Validator

A validation library for product data that validates multiple independent fields in parallel.

Capabilities

Validates individual fields

  • Validates name field returns success with "Laptop" for { name: "Laptop", price: 999, quantity: 5 } @test
  • Validates price field returns success with 999 for { name: "Laptop", price: 999, quantity: 5 } @test
  • Validates name field returns failure when name is not a string @test

Combines independent validations

  • Returns success with { name: "Laptop", price: 999, quantity: 5 } when all fields are valid @test
  • Returns all errors when multiple fields are invalid for input { name: 123, price: "999", quantity: "5" } @test

Implementation

@generates

API

import { Either } from 'fp-ts/Either';

/**
 * Validates a product name field independently
 */
export function validateName(input: unknown): Either<Error[], string>;

/**
 * Validates a product price field independently
 */
export function validatePrice(input: unknown): Either<Error[], number>;

/**
 * Validates a product quantity field independently
 */
export function validateQuantity(input: unknown): Either<Error[], number>;

/**
 * Validates all product fields by combining independent validations
 */
export function validateProduct(input: unknown): Either<Error[], { name: string; price: number; quantity: number }>;

Dependencies { .dependencies }

io-ts { .dependency }

Provides decoder composition for combining independent field validations.

@satisfied-by

fp-ts { .dependency }

Provides Either type for representing validation results.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/io-ts@2.2.x
tile.json