satisfies
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
satisfies kontrollon që një vlerë i përshtatet një tipi, por pa e humbur tipin e saj më të saktë. P.sh. një objekt ngjyrash kontrollohet si Record<string, string>, por TypeScript-i mban mend saktë cilat çelësa ka.
EnglishEN
satisfies checks that a value fits a type without losing its more precise type. E.g. a colours object is checked as Record<string, string>, but TypeScript still remembers exactly which keys it has.
Si ta mendosh
Si inspektimi teknik i veturës: kontrollon që i plotëson rregullat, pa e ndryshuar modelin e veturës.
Lexoje në anglisht
Like a car's roadworthiness test: it checks it meets the rules without changing the car's model.
Shembull koditypescript
const ngjyrat = {
kuqe: "#e11d48", blu: "#2563eb",
} satisfies Record<string, string>;
ngjyrat.kuqe; // TypeScript e di që ekziston