tessl install tessl/npm-io-ts@2.2.0TypeScript 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%
Build a runtime validation system for a complex user profile data structure that includes nested objects and collections.
The system must validate user profile data that contains multiple levels of nested objects and arrays. A valid user profile has the following structure:
@generates
/**
* Validates user profile data against the expected schema.
* Returns a validation result that indicates success or failure with error details.
*/
export function validateUserProfile(data: unknown): ValidationResult;
/**
* Type representing the validated user profile structure.
*/
export type UserProfile = {
user: {
id: number;
username: string;
email: string;
};
settings: {
preferences: {
theme: "light" | "dark";
language: string;
notifications: boolean;
};
privacy: {
profileVisible: boolean;
allowMessages: boolean;
};
};
addresses: Array<{
street: string;
city: string;
zipCode: string;
coordinates: {
latitude: number;
longitude: number;
};
}>;
socialConnections: Array<{
platform: "twitter" | "linkedin" | "github";
profile: {
handle: string;
verified: boolean;
};
}>;
};
/**
* Validation result containing either the validated data or error information.
*/
export type ValidationResult =
| { success: true; data: UserProfile }
| { success: false; errors: string[] };Provides runtime type validation for TypeScript.
Provides functional programming utilities for handling validation results.