Definitelytyped: [@types/config] config.get is not a function

Created on 2 Jan 2019  路  6Comments  路  Source: DefinitelyTyped/DefinitelyTyped

If you know how to fix the issue, make a pull request instead.

  • [x] I tried using the @types/config package and had problems.
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [ ] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @RWander @forrestbice @albertovasquez

On Node.js 8.11.1, NPM 6.5.0
[email protected]
[email protected]
[email protected]
@types/[email protected]

I was using before([email protected]):

import * as config from "config";
config.get("key")

but, there is error in current version as follow:

TypeError: config.get is not a function

Can you check this?

Most helpful comment

You have to import this module like this:

import config = require("config");

You can check here for more infos about the _why_.

All 6 comments

You have to import this module like this:

import config = require("config");

You can check here for more infos about the _why_.

@BendingBender
I read it but that solution is seems like a kind of expedient.
Impossible to solve it TS grammarly?

Sorry, I'm not sure what you mean. Did you try the solution? Did it work for you?

Yeah, it does work, but I want to run too:

import * as config from "config";

Then use either the --allowSyntheticDefaultImports or --esModuleInterop compiler option.

@BendingBender Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings