A generic array wrapper can retain the type of the incoming value. That lets consumers reuse the helper without losing useful editor feedback.
Worked example
const words = ["build", "ship", "test"];
console.log((<T,>(value: T): T[] => [value])("ready"));Result
[ 'ready' ]Implementation notes
A generic helper preserves the type information it receives. If the incoming argument was already typed as any, wrapping it cannot restore the lost contract.
Try it yourself
Call it once with a number and once with an object and inspect the inferred types.
Open the TypeScript example →Editorial date May 20, 2026 · Published December 6, 2026