“Property does not exist on type”
Në shqip: Gabimi „Property does not exist“
ShpjegimiSQ
Ky gabim do të thotë që TypeScript s'e di se objekti ka atë veti — shpesh sepse tipi është union dhe s'e ke ngushtuar, ose sepse e ke shkruar gabim emrin.
EnglishEN
This error means TypeScript doesn't know the object has that property — often because the type is a union you haven't narrowed, or you misspelled the name.
Si ta mendosh
Si të kërkosh sirtarin e katërt në një komodinë me tre.
Lexoje në anglisht
Like looking for the fourth drawer in a three-drawer chest.
Shembull koditypescript
function shfaq(x: string | number) {
x.toUpperCase(); // ✗ nuk ekziston te number
if (typeof x === "string") x.toUpperCase(); // ✓
}