tusharmath / node-config-ts

A simple node configuration manager
61 stars 31 forks source link

JSON objects named `config` break type definition #67

Open tmus opened 3 years ago

tmus commented 3 years ago

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:

Typescript Version: 4.0.5

node-config-ts version: 3.1.0