Type Safety For ENV Variables

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

It is bad practice to declare types like this in a ts file. Better to add it in a d.ts file.
For Sveltekit, I had to add declare namespace NodeJS and interface ImportMetaEnv in the app.d.ts file under the declare global block (for anyone on SvelteKit)

kristianlavigne
Автор

Somehow the parent block `declare global {...}` doesn't work for me. So I remove it and everything then works as expected.

sonxuannguyen