JSON objects named `config` break type definition
tmus opened this issue · 0 comments
tmus commented
Describe the bug:
In default.json, creating an object with a key of config
breaks the type definitions for the config as a whole.
Steps To Reproduce:
For example:
// default.json
{
"config": {
"some": "value"
},
"someother": "value"
}
Results in:
// Config.d.ts
/* tslint:disable */
/* eslint-disable */
declare module "node-config-ts" {
interface IConfig {
config: Config
someother: string
}
interface Config {
some: string
}
export const config: Config
export type Config = IConfig
}
Typehinting now doesn't find the someother
property on the config, only some
, as part of the defined config object.
Expected behavior:
Any of:
- Document that
config
is a keyword and should not be used in config - Change the name of the exported type to something more specific, to prevent a clash
- Throw an error when attempting to run
node-config-ts
if aconfig
key exists.
Typescript Version: 4.0.5
node-config-ts version: 3.1.0