I Can’t Believe This TS Feature Has No Documentation

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

TypeScript has an undocumented feature called const generics, which lets you add the `const` keyword before a generic type parameter. This automatically applies `as const` semantics to any value passed into the function, giving you the strictest possible literal type inference without requiring callers to manually append `as

1m watch time

Sort: