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

File System Structure Validator

Build a runtime type validator for a simplified file system structure where directories can contain files, and files reference their parent directories. This creates a mutually recursive relationship between the two types.

Requirements

Create runtime validators for two interdependent types:

  1. Directory: An object with:

    • type: Always the literal value "directory"
    • name: A string
    • contents: An array of File objects (can be empty)
  2. File: An object with:

    • type: Always the literal value "file"
    • name: A string
    • parentDir: A Directory object

Your validators should:

  • Validate runtime data and return success or failure results
  • Extract TypeScript types from the runtime validators

Test Cases

  • Validates a directory with one file that references the directory @test
  • Validates a directory with multiple files @test
  • Validates an empty directory @test
  • Rejects invalid directory structure @test

Dependencies { .dependencies }

io-ts { .dependency }

Provides runtime type validation and decoding capabilities.

@satisfied-by

Version

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