const type parameters
Në shqip: Parametrat e tipit const
ShpjegimiSQ
Me <const T>, TypeScript e nxjerr tipin sa më saktë, si me as const — p.sh. ["a", "b"] bëhet readonly ["a", "b"], jo string[].
EnglishEN
With <const T>, TypeScript infers the type as precisely as possible, like with as const — e.g. ["a", "b"] becomes readonly ["a", "b"], not string[].
Si ta mendosh
Si të shënosh saktësisht cilat fruta ka shporta, jo vetëm „fruta“.
Lexoje në anglisht
Like noting exactly which fruit the basket has, not just “fruit”.
Shembull koditypescript
function rrugët<const T extends readonly string[]>(r: T) { return r; }
const r = rrugët(["/", "/rreth"]); // readonly ["/", "/rreth"]