I like the tricks :) – Kasia
Use Extract to derive a type from another one and maintain a single point-of-truth.
type Keys = "commentId" | "userId" | "rating" type Refs = "commentId" | "userId" // ⛔️ Need to keep Keys and Refs in sync
type Keys = "commentId" | "userId" | "rating" type Refs = Extract<Keys, `${string}Id`> // ^? "commentId" | "userId"
Crafted with 💛 by Riccardo