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-5/

Configuration Key Validator

Build a configuration validation system that validates configuration keys against a predefined set of allowed keys. The system should define a set of valid configuration options (e.g., "timeout", "retries", "maxConnections") and ensure that only keys from this set are accepted.

Requirements

Validates allowed configuration keys

The system must accept only valid configuration keys from a predefined set of allowed options (at least 3 different valid keys).

  • When given a valid configuration key like "timeout", it validates successfully @test
  • When given an invalid configuration key like "invalid_option", it rejects the value @test

Handles configuration objects with key validation

The system must validate that configuration objects only contain keys from the allowed set.

  • When given an object with valid keys like { setting: "timeout" }, it validates successfully @test
  • When given an object with an invalid key reference, it rejects the object @test

Implementation

@generates

API

/**
 * Validates configuration keys against allowed options
 * Returns Either with validation result
 */
export function validateConfigKey(key: unknown): unknown;

/**
 * Validates a configuration object containing a key field
 * Returns Either with validation result
 */
export function validateConfigObject(config: unknown): unknown;

Dependencies { .dependencies }

io-ts { .dependency }

Provides runtime type validation support.

fp-ts { .dependency }

Provides functional programming utilities for Either types.

Version

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