Code Explainers

Code explainers tagged #runtime-validation

typescript
import { z, type ZodType } from "zod";
 
export class HttpError extends Error {
  constructor(

A type-safe fetch wrapper with Zod

generics runtime-validation error-handling
Intermediate 8 steps
typescript
type User = {
  id: number;
  email: string;
  roles: string[];

Validating API data with TypeScript type guards

type-guards runtime-validation type-narrowing
Intermediate 8 steps
python
from dataclasses import dataclass, fields, MISSING
from typing import get_type_hints, get_origin, get_args, Union
 
 

Type-checking dataclasses at runtime

dataclasses type-hints runtime-validation
Advanced 8 steps