sdxc-types

Provides TypeScript utility types for JSON serialization boundaries and async return values.

5|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-types-sergiodxa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sdxc-types
Source: https://github.com/sergiodxa/monorepo/tree/main/.agents/skills/sdxc-types
Command: npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-types-sergiodxa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Values crossing a JSON boundary lose their types: a Date pushed onto a queue comes back as a string, JSON.parse returns any, and component props drift out of sync with the data functions that feed them. This Skill documents a types-only package that names both sides of that boundary so the compiler catches the mismatch. ## Core Features & Use Cases - JSON boundary typing: JSONSerializable constrains what can be written (including values with toJSON like Date and URL), JSONValue types what is read back, and JSONSerialized<T> derives the post-round-trip shape of a written type. - Async and type-level utilities: ResolvedType<T> unwraps what an async function resolves to, JSONPrimitive names scalar leaves, and IsAny<T> branches on values typed as any. - Use Case: When constraining a queue message or cache entry, use JSONValue as a generic bound so invalid values like Date are rejected at compile time while the caller's literal shape is preserved. ## Quick Start Add @sdxc/types as a workspace dependency and import the JSONValue type to constrain a function that enqueues JSON-safe payloads.

Frequently Asked Questions about sdxc-types

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I type a value that must survive JSON serialization in TypeScript?▼

Use JSONSerializable as a generic bound on the write side, since it accepts values with toJSON like Date and URL. On the read side, use JSONValue or JSONSerialized<T> to describe what actually comes back after the round trip.

How to derive component props from an async data function's return type?▼

Use ResolvedType<typeof fn> to unwrap the resolved value of an async function, then index into it, for example ResolvedType<typeof listPosts>["posts"][number]. This keeps props in sync without restating the shape.

Should JSONValue be used as a parameter type or a generic constraint?▼

Use it as a generic bound, never as the parameter type. As a bound it only rules out invalid values while preserving the caller's literal shape; as a parameter type it widens the argument to the whole union and properties like payload.id stop existing.

Does @sdxc/types include any runtime code?▼

No, the package is types-only and ships no runtime code. Everything is imported with import type, so it adds nothing to the bundle and only affects compile-time checking.

What are the limitations of the JSONSerialized type?▼

JSONSerialized describes shape, not value: cycles still throw, NaN and Infinity read back as null, and inherited properties are kept by the type while JSON.stringify omits them. It also tracks only nine nesting levels before widening to JSONValue.