Importing JSON with types
Në shqip: Importimi i JSON me tipe
ShpjegimiSQ
Me resolveJsonModule, mund të importosh një skedar .json dhe TypeScript i nxjerr vetë tipet nga përmbajtja. Te modulet ES duhet edhe with { type: "json" }.
EnglishEN
With resolveJsonModule, you can import a .json file and TypeScript infers the types from its contents. In ES modules you also need with { type: "json" }.
Si ta mendosh
Si të hapësh një kuti dhe etiketa të shkruhet vetë sipas asaj që ka brenda.
Lexoje në anglisht
Like opening a box and having the label write itself from what's inside.
Shembull koditypescript
import konfig from "./konfig.json" with { type: "json" };
konfig.gjuha; // string