tusharmath / node-config-ts

A simple node configuration manager
61 stars 31 forks source link

'No reserved words' doesn't seem to be accurate #44

Closed umdstu closed 4 years ago

umdstu commented 4 years ago

In the documentation it indicates that this package has no reserved words (https://github.com/tusharmath/node-config-ts#differences-with-node-config), however, I came across some weird behavior until I renamed my nested json config.

In my json I had:

{
  ...
  "log": {
    "console": {
      "info": false,
      "trace": false,
      "error": false
    }
  }
  ...
}

So when I went to do if (config.log.console.info) {} it was saying that it had to be a function not boolean. So renaming console to something else (less intuitive) it worked. So I think that conflict indicates a reserved word right?

tusharmath commented 4 years ago

@umdstu Thanks for reporting the bug.

The typings that are generated for your config, conflict with the typings that are provided by typescript for console.

The issue is over here — https://github.com/tusharmath/node-config-ts/blob/master/src/createTypedefs.ts#L13

I will try to fix the bug this week sometime, unfortunately its going to be a breaking change.

umdstu commented 4 years ago

Awesome, thanks for confirming. No rush on my end, i just needed to rename it. I recalled reading there shouldn’t be Any conflicts so i just i wanted bring it up. I look forward to seeing the impact.

tusharmath commented 4 years ago

:tada: This issue has been resolved in version 3.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: