tusharmath / node-config-ts

A simple node configuration manager
61 stars 31 forks source link

Could not find a declaration file for module 'node-config-ts'. #51

Closed sconnor-npr closed 4 years ago

sconnor-npr commented 4 years ago

I'm getting the following errors starting at version 3.0.0.

Could not find a declaration file for module 'node-config-ts'. '.../node_modules/node-config-ts/index.js' implicitly has an 'any' type. Trynpm install @types/node-config-tsif it exists or add a new declaration (.d.ts) file containingdeclare module 'node-config-ts';ts(7016).

It looks as though the index.d.ts file is missing from the node_modules sub-directory. Everything works fine before version 3.0.0.

tusharmath commented 4 years ago

Hi @sconnor-npr

  1. Did you follow the steps here — https://github.com/tusharmath/node-config-ts#usage
  2. Make sure you add a postinstall script
    {
    "scripts": {
    "postinstall": "node-config-ts"
    }
    }
  3. And then run npm i or yarn.
sconnor-npr commented 4 years ago

I did. Version 2.3.1 and down works as expected. It looks like versions before 3.0.0 include an index.d.ts file with the following contents that do not exist in the newer versions:

 * Created by tushar on 30/12/17.
 */
export declare const config: Config;
tusharmath commented 4 years ago

Do you have a local tsconfig.json? If you don't can you try this command and create one?

tsc --init
sconnor-npr commented 4 years ago

I do have a tsconfig.json. Is there a reason the index.d.ts file wasn't included in versions > 3.0.0?

tusharmath commented 4 years ago

The type-def is created inside config.d.ts I don't think we needed index.d.ts anyways. That's why it was removed.

Can you create a quick repro on github maybe that I can checkout?

mcianc commented 3 years ago

I have the same problem, any updates on how it was solved?

navxio commented 3 years ago

@tusharmath this issue should be open. Facing it with v3.0.4

colorcube commented 3 years ago

v2.2.4 worked for me, but 3.x does not (with the mentioned error) v3.1.0 is affected too

henrysachs commented 3 years ago

same issue here. I already tried moving the config folder to the typeroots but is isnt working as intended.

tusharmath commented 3 years ago

Please open create a bug report and I would be happy to help. Closing this conversation.