DEV Community

loading...

Discussion on: Converting a JavaScript project to Typescript, one file at a time

Collapse
vyemialyanchyk profile image
vyemialyanchyk

what is a right way to declare ENVIRONMENT_CONFIG & DEBUG with webpack.DefinePlugin example:

new webpack.DefinePlugin({
ENVIRONMENT_CONFIG: JSON.stringify(environmentConfig),
DEBUG: JSON.stringify(DEBUG),
}),

cause I get:

ERROR in ./src/app/utils/Utility.ts
(11,26): error TS2304: Cannot find name 'ENVIRONMENT_CONFIG'.

Collapse
suhas_chatekar profile image
Suhas Chatekar Author

Are you able to provide complete code of utility.ts?

Collapse
vyemialyanchyk profile image
vyemialyanchyk

not a big sense here, ENVIRONMENT_CONFIG used in several files, so errors in several places, this is example:

if (ENVIRONMENT_CONFIG.FLAG_1 === '0') {
...
} else if (ENVIRONMENT_CONFIG.FLAG_1 === '1') {
...
} else {
...
}

I've found workable solution: stackoverflow.com/questions/460086...
but I do not like "typings" folder use, cause "typings" expected to be vanished with typings lib use, imo.