microsoft / dts-gen

dts-gen creates starter TypeScript definition files for any module or library.
MIT License
2.44k stars 102 forks source link

Crash when run on winston 3.0.0-rc1 #94

Open TheAppleFreak opened 6 years ago

TheAppleFreak commented 6 years ago

I've been trying to run dts-gen against winston, a logging library that I'm using for a project right now. While it has typings on DefinitelyTyped, they're for the 2.x.x releases, and 3.x.x has some major breaking changes for the old API. However, when I try to generate typings for the new version, dts-gen throws an unexpected error with the following:

PS E:\types> .\node_modules\.bin\dts-gen -m winston
Unexpected crash! Please log a bug with the commandline you specified.
E:\types\node_modules\dts-gen\bin\lib\run.js:130
        throw e;
        ^

Error: { emitErrs } was removed in winston@3.0.0.
    at Object.<anonymous> (E:\types\node_modules\winston\lib\winston\common.js:143:13)
    at getProperty (E:\types\node_modules\dts-gen\bin\lib\index.js:254:30)
    at Array.map (<anonymous>)
    at getPropertyDeclarationsOfObject (E:\types\node_modules\dts-gen\bin\lib\index.js:250:25)
    at getTypeOfValue (E:\types\node_modules\dts-gen\bin\lib\index.js:237:33)
    at getResult (E:\types\node_modules\dts-gen\bin\lib\index.js:173:32)
    at getTopLevelDeclarations (E:\types\node_modules\dts-gen\bin\lib\index.js:123:17)
    at Object.generateModuleDeclarationFile (E:\types\node_modules\dts-gen\bin\lib\index.js:49:19)
    at Object.<anonymous> (E:\types\node_modules\dts-gen\bin\lib\run.js:57:24)
    at Module._compile (module.js:612:30)

Apparently they deprecated a property called emitErrs, and dts-gen apparently doesn't quite know how to handle that.

My environment is a Windows 10 machine running Node 8.8.0. Additionally, this is my package.json (this project was created just to work on the typings):

{
  "name": "test",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "dts-gen": "^0.5.7",
    "winston": "^3.0.0-rc1"
  }
}