How to simplify generic pattern 'X extends Y = Y'?

10 hours ago 2
ARTICLE AD BOX

I find myself having to write X extends Y = Y a lot when creating types in TypeScript, for example:

type T<V extends X = X> = ...

When my types get very long (working on a personalized, type-safe dynamic UI generator), I keep reading over and over ugly and repetitive code sections filed with

type UIParagraphNode<V extends ParagraphVariants = ParagraphVariants> = ... type UIParagraphNode<V extends ParagraphVariants = ParagraphVariants> = ...

It keeps getting more and more ugly. I was thinking something like T<X <= Y> or T<X extends & = Y. Is there a simpler way to write this expression?

Read Entire Article