I like the tricks :) – Kasia
Make TypeScript v5+ infer the more specific type (instead of the most generic).
const first = (xs: unknown[]) => xs[0] pick(["a", "b"]) // ^? unknown const first = (xs: any[]) => xs[0] pick(["a", "b"]) // ^? any const first = <T>(xs: T[]) => xs[0] pick(["a", "b"]) // ^? string
const pick = <const T>(xs: T[]) => xs[0] pick(["a", "b"]) // ^? "a" | "b"
Crafted with 💛 by Riccardo