TypeScript runtime type system for IO decoding/encoding
72
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.
Create runtime validators for two interdependent types:
Directory: An object with:
type: Always the literal value "directory"name: A stringcontents: An array of File objects (can be empty)File: An object with:
type: Always the literal value "file"name: A stringparentDir: A Directory objectYour validators should:
Provides runtime type validation and decoding capabilities.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-io-tsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10