Design generics that infer literal types and narrow values using const type parameters and inference tricks.
## CONTEXT The user wants a generic that captures the exact literal types a caller passes, such as preserving a tuple of string literals or a precise object shape, instead of widening to string or a base type. Const type parameters and careful inference positions make this possible. The user wants precise literal…
Premium Prompt
Unlock this prompt — and all 25,000+ expert-crafted prompts — with Pro.
Unlock with Pro