TypeScript

Type space vs value space

Në shqip: Bota e tipeve dhe bota e vlerave

ShpjegimiSQ

Në TypeScript, disa emra ekzistojnë vetëm si tipe (type, interface), disa vetëm si vlera (const, function), dhe disa si të dyja (class, enum). typeof brenda një tipi të çon nga vlera te tipi i saj.

EnglishEN

In TypeScript, some names exist only as types (type, interface), some only as values (const, function), and some as both (class, enum). typeof inside a type takes you from a value to its type.

Si ta mendosh

Si dallimi mes planit të shtëpisë dhe vetë shtëpisë.

Lexoje në anglisht

Like the difference between a house's blueprint and the house itself.

Shembull koditypescript

const konfig = { gjuha: "sq", tema: "e-erret" };
type Konfig = typeof konfig;   // { gjuha: string; tema: string }

Terma të lidhur