dts-gen is now part of microsoft/DefinitelyTyped-tools.
microsoft / dts-gen Goto Github PK
View Code? Open in Web Editor NEWdts-gen creates starter TypeScript definition files for any module or library.
License: MIT License
dts-gen creates starter TypeScript definition files for any module or library.
License: MIT License
dts-gen is now part of microsoft/DefinitelyTyped-tools.
Steps:
var x = {};
function TheFunction(y) {
}
TheFunction(x);
Unexpected crash! Please log a bug with the commandline you specified.
C:\Users\MY USERNAME\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:109
throw e;
^
Error
at ArgsError.Error (native)
at new ArgsError (C:\Users\MY USERNAME\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:25:28)
at Object.<anonymous> (C:\Users\MY USERNAME\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:39:15)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3
/home/andy/types/dts-gen/bin/lib/run.js:109
throw e;
^
Error
at new ArgsError (/home/andy/types/dts-gen/bin/lib/run.js:25:28)
at Object.<anonymous> (/home/andy/types/dts-gen/bin/lib/run.js:39:15)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
One of the library dependencies is causing dts-gen to crash.
npm install -g [email protected]
dts-gen
or
npm install -g [email protected]
dts-gen
Unexpected crash! Please log a bug with the commandline you specified.
/usr/local/lib/node_modules/dts-gen/bin/lib/run.js:109
throw e;
^
Error
at new ArgsError (/usr/local/lib/node_modules/dts-gen/bin/lib/run.js:25:28)
at Object.<anonymous> (/usr/local/lib/node_modules/dts-gen/bin/lib/run.js:39:15)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:418:7)
at startup (bootstrap_node.js:139:9)
OS: Mac OS X 10.12.3
Node: 7.5.0
NPM: 4.2.0
I'll look to see if I can find the cause.
The two commands seem the same. What are the differences and which one should I use?
After installing dts-gen with npm install -g dts-gen
running it always triggers the error no such file or directory
. It doesn't matter what flags I use of if I use no flags at all.
Running on debian linux with node v5.11.2 and npm 3.8.6
$ dts-gen -m prosemirror-schema-basic
Unexpected crash! Please log a bug with the commandline you specified.
/Users/jtblin/.nvm/versions/node/v7.6.0/lib/node_modules/dts-gen/bin/lib/index.js:87
keys.sort();
^
RangeError: Maximum call stack size exceeded
at Array.sort (native)
at getKeysOfObject (/Users/jtblin/.nvm/versions/node/v7.6.0/lib/node_modules/dts-gen/bin/lib/index.js:87:10)
at getPropertyDeclarationsOfObject (/Users/jtblin/.nvm/versions/node/v7.6.0/lib/node_modules/dts-gen/bin/lib/index.js:251:18)
at getResult (/Users/jtblin/.nvm/versions/node/v7.6.0/lib/node_modules/dts-gen/bin/lib/index.js:238:37)
at getTypeOfValue (/Users/jtblin/.nvm/versions/node/v7.6.0/lib/node_modules/dts-gen/bin/lib/index.js:209:17)
at getResult (/Users/jtblin/.nvm/versions/node/v7.6.0/lib/node_modules/dts-gen/bin/lib/index.js:219:47)
at getTypeOfValue (/Users/jtblin/.nvm/versions/node/v7.6.0/lib/node_modules/dts-gen/bin/lib/index.js:209:17)
at getProperty (/Users/jtblin/.nvm/versions/node/v7.6.0/lib/node_modules/dts-gen/bin/lib/index.js:259:45)
at Array.map (native)
at getPropertyDeclarationsOfObject (/Users/jtblin/.nvm/versions/node/v7.6.0/lib/node_modules/dts-gen/bin/lib/index.js:252:25)
yarn list enquire.js
yarn list v0.19.1
└─ [email protected]
dts-gen enquire.js
Unexpected crash! Please log a bug with the commandline you specified.
C:\Users\lukas.gorniak\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:109
throw e;
^
Error
at ArgsError.Error (native)
at new ArgsError (C:\Users\l.g\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:25:28)
at Object. (C:\Users\l.g\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:39:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
Missing template option
$ npm i [email protected]
$ npm ls dts-gen
[email protected] ~/test-ts
└── [email protected]
$ cat node_modules/dts-gen/bin/lib/run.js | head -25
#!/usr/bin/env node
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var guess = require("./");
var yargs = require("yargs");
var fs = require("fs");
var path = require("path");
var args = yargs
.alias('m', 'module')
.alias('i', 'identifier')
.alias('e', 'expression')
.alias('n', 'name')
.alias('f', 'file')
.alias('d', 'dt')
.alias('s', 'stdout')
.alias('o', 'overwrite')
.argv;
var ArgsError = (function (_super) {
__extends(ArgsError, _super);
function ArgsError(argsError) {
var _this = _super.call(this) || this;
dts-gen -m yargs
C:\Users\melhamod\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\definitely-typed.js:40
for (const [name, text] of files) {
^
SyntaxError: Unexpected token [
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (C:\Users\melhamod\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:8:28)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
To reproduce:
dts-gen -m offline-plugin
or dts-gen -m "offline-plugin"
(in the above directory).Error:
Unexpected crash! Please log a bug with the commandline you specified.
/home/node/workspace/node_modules/dts-gen/bin/lib/run.js:130
throw e;
^
TypeError: Cannot read property 'version' of undefined
at Object.get (/home/node/workspace/node_modules/offline-plugin/lib/index.js:741:33)
at getProperty (/home/node/workspace/node_modules/dts-gen/bin/lib/index.js:254:30)
at Array.map (native)
at getPropertyDeclarationsOfObject (/home/node/workspace/node_modules/dts-gen/bin/lib/index.js:250:25)
at getTypeOfValue (/home/node/workspace/node_modules/dts-gen/bin/lib/index.js:237:33)
at getResult (/home/node/workspace/node_modules/dts-gen/bin/lib/index.js:173:32)
at getTopLevelDeclarations (/home/node/workspace/node_modules/dts-gen/bin/lib/index.js:123:17)
at getResult (/home/node/workspace/node_modules/dts-gen/bin/lib/index.js:148:17)
at getTopLevelDeclarations (/home/node/workspace/node_modules/dts-gen/bin/lib/index.js:123:17)
at Object.generateModuleDeclarationFile (/home/node/workspace/node_modules/dts-gen/bin/lib/index.js:49:19)
I was trying to generate .d.ts
for listr
/** Declaration file generated by dts-gen */
export = listr;
declare class listr {
constructor(...args: any[]);
add(...args: any[]): void;
render(...args: any[]): void;
run(...args: any[]): void;
setRenderer(...args: any[]): void;
}
declare namespace listr {
namespace prototype {
// ^^^^^^^^^==============================> problem
const tasks: any;
function add(...args: any[]): void;
function render(...args: any[]): void;
function run(...args: any[]): void;
function setRenderer(...args: any[]): void;
}
}
says
Duplicate identifier 'prototype'
Suppose I created a .d.ts file for a package library. Then, the author of library changed a few function definitions. If I run dts-gen -m library it will overwrite types in the exiting definition with any
Can dts-gen overwrite only changed definitions?
Just run npm run test
. @RyanCavanaugh
Currently dts-gen forces users, to install library.,which we want generate types from, globally -> this is super annoying, forcing users to pollute they global npm store is also very unfortunate.
Can this be implemented?
thanks
Running the command dts-gen -d -m feathers
crashed with the following error message:
Unexpected crash! Please log a bug with the commandline you specified.
C:\Users\cke\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:109
throw e;
^
TypeError: Cannot read property 'statusCode' of undefined
at IncomingMessage.fresh (C:\Users\cke\Documents\Development\DefinitelyTyped\node_modules\express\lib\request.js:450:19)
at getProperty (C:\Users\cke\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:264:30)
at Array.map (native)
at getPropertyDeclarationsOfObject (C:\Users\cke\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:260:23)
at getResult (C:\Users\cke\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:246:35)
at getTypeOfValue (C:\Users\cke\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:217:15)
at getResult (C:\Users\cke\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:177:30)
at getTopLevelDeclarations (C:\Users\cke\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:126:15)
at getResult (C:\Users\cke\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:152:17)
at getTopLevelDeclarations (C:\Users\cke\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:126:15)
dts-gen --dt --module mongo-models
Unexpected crash! Please log a bug with the commandline you specified.
/home/athroener/.nvm/versions/node/v8.1.0/lib/node_modules/dts-gen/bin/lib/run.js:130
throw e;
^
TypeError: Cannot read property '3' of undefined
at Object.get [as generationTime] (/home/athroener/.nvm/versions/node/v8.1.0/lib/node_modules/mongodb/node_modules/bson/lib/bson/objectid.js:346:20)
at getProperty (/home/athroener/.nvm/versions/node/v8.1.0/lib/node_modules/dts-gen/bin/lib/index.js:254:30)
at Array.map (native)
at getPropertyDeclarationsOfObject (/home/athroener/.nvm/versions/node/v8.1.0/lib/node_modules/dts-gen/bin/lib/index.js:250:25)
at getTypeOfValue (/home/athroener/.nvm/versions/node/v8.1.0/lib/node_modules/dts-gen/bin/lib/index.js:237:33)
at getResult (/home/athroener/.nvm/versions/node/v8.1.0/lib/node_modules/dts-gen/bin/lib/index.js:173:32)
at getTopLevelDeclarations (/home/athroener/.nvm/versions/node/v8.1.0/lib/node_modules/dts-gen/bin/lib/index.js:123:17)
at getResult (/home/athroener/.nvm/versions/node/v8.1.0/lib/node_modules/dts-gen/bin/lib/index.js:148:17)
at getTopLevelDeclarations (/home/athroener/.nvm/versions/node/v8.1.0/lib/node_modules/dts-gen/bin/lib/index.js:123:17)
at getResult (/home/athroener/.nvm/versions/node/v8.1.0/lib/node_modules/dts-gen/bin/lib/index.js:148:17)
I am a newbie in typescript following typescript node starter tutorial. I ran dts-gen on excel4node
v1.2.1
. The generated d.ts
has error at:
export namespace Workbook {
namespace prototype {
function addWorksheet(name: any, opts: any): any;
function createStyle(opts: any): any;
function getStringIndex(val: any): any;
function setSelectedTab(id: any): void;
function write(fileName: any, handler: any): void;
function writeToBuffer(): any;
...
-- typescript complains "src/types/excel4node.d.ts(475,15): error TS2300: Duplicate identifier 'prototype"
I would guess this is a bug triggered by source code referencing functions explicitly through the prototype
property.... Will I be ok if I just delete the offending definition? After all above I see:
export class Workbook {
constructor(opts: any);
addWorksheet(name: any, opts: any): any;
createStyle(opts: any): any;
getStringIndex(val: any): any;
setSelectedTab(id: any): void;
write(fileName: any, handler: any): void;
writeToBuffer(): any;
}
To reproduce just run dts-gen -m libsodium-wrappers
The package uses crypto so it makes sense it's heavy on ram. Not sure if there is a way to work around this.
While dts-gen shouldn't crash, it's just going to sometimes. That's fine, but DefinitelyTyped used to have a script that consistently worked. Now the instructions are to rely on dts-gen entirely, and having just tried it on a library (moonjs
), it just crashed.
This package needs to have some sort of general graceful fallback behavior if DefinitelyTyped is going to rely on it. Otherwise we're making it way too annoying/difficult to contribute.
CC @andy-ms @RyanCavanaugh @mhegazy
Using default instructions, on 'tone' npm module (Tone.js)
Unexpected crash! Please log a bug with the commandline you specified.
/usr/local/lib/node_modules/dts-gen/bin/lib/run.js:107
throw e;
^
ReferenceError: window is not defined
at Object. (/usr/local/lib/node_modules/angular/angular.js:31766:4)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/angular/index.js:1:63)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
We currently emit too much stuff into clodules when we could be writing static class members instead
c:\ae\dts-gen>npm list svg.js
c:\ae\dts-gen
`-- [email protected]
$ dts-gen -m dynamodb 1
Unexpected crash! Please log a bug with the commandline you specified.
/Users/marmos91/.nvm/versions/node/v7.10.0/lib/node_modules/dts-gen/bin/lib/run.js:130
throw e;
^
TypeError: Method get TypedArray.prototype.buffer called on incompatible receiver [object Object]
at Uint8Array.get buffer [as buffer] (<anonymous>)
at getProperty (/Users/marmos91/.nvm/versions/node/v7.10.0/lib/node_modules/dts-gen/bin/lib/index.js:254:30)
at Array.map (native)
at getPropertyDeclarationsOfObject (/Users/marmos91/.nvm/versions/node/v7.10.0/lib/node_modules/dts-gen/bin/lib/index.js:250:25)
at getTypeOfValue (/Users/marmos91/.nvm/versions/node/v7.10.0/lib/node_modules/dts-gen/bin/lib/index.js:237:33)
at getResult (/Users/marmos91/.nvm/versions/node/v7.10.0/lib/node_modules/dts-gen/bin/lib/index.js:173:32)
at getTopLevelDeclarations (/Users/marmos91/.nvm/versions/node/v7.10.0/lib/node_modules/dts-gen/bin/lib/index.js:123:17)
at getResult (/Users/marmos91/.nvm/versions/node/v7.10.0/lib/node_modules/dts-gen/bin/lib/index.js:148:17)
at getTopLevelDeclarations (/Users/marmos91/.nvm/versions/node/v7.10.0/lib/node_modules/dts-gen/bin/lib/index.js:123:17)
at getResult (/Users/marmos91/.nvm/versions/node/v7.10.0/lib/node_modules/dts-gen/bin/lib/index.js:191:35)
If we can locate the source (either by having the user specify as an additional argument, or grokking node modules ourselves), we can try to line up the function and property jsdoc comments by name and re-attach them in the .d.ts, as well as put in inferred types.
I'm trying
dts-gen --expression-file ./index.js
But I get
Couldn't load module "undefined". Please install it globally (npm install -g undefined) and try again.
Which doesn't make much sense.
How can I generate a .d.ts
file for my library without having to globally install it first?
I think that forcing users to do a second install is a real pain since it's already installed. Is there any way we can make this work for a local node_modules
folder?
For example:
dts-gen -m @mapbox/sphericalmercator cannot be working but
dts-gen -m sphericalmercator is working
Following error occurred when generating *.d.ts files for module 'sequelize'
C:\Users\pavel\Desktop\node development\card-processer>dts-gen -m sequelize
Unexpected crash! Please log a bug with the commandline you specified.
C:\Users\pavel\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:109
throw e;
^
TypeError: Cannot read property 'getConnectorManager' of undefined
at Sequelize.get (C:\Users\pavel\Desktop\node development\card-processer\node_modules\sequelize\lib\sequelize.js:315:35)
at C:\Users\pavel\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:272:143
at Array.map (native)
at getClassPrototypeMembers (C:\Users\pavel\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:272:75)
at getResult (C:\Users\pavel\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:138:17)
at getTopLevelDeclarations (C:\Users\pavel\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:126:15)
at Object.generateModuleDeclarationFile (C:\Users\pavel\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:49:17)
at Object. (C:\Users\pavel\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:54:24)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
Title says it all. This uncovers a few things.
Just gave dts-gen
a try because the react-helmet
types from DefinitelyTyped aren't working properly in my React-Redux SPA.
Sady dts-gen -m react-helmet
leads to:
Unexpected crash! Please log a bug with the commandline you specified.
dts-gen : C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:109
In Zeile:1 Zeichen:1
+ dts-gen -m react-helmet
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (C:\Users\harald...\lib\run.js:109:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
throw e;
^
TypeError: Cannot convert undefined or null to object
at isClasslike (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:112:39)
at getResult (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:135:17)
at getTopLevelDeclarations (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:126:15)
at getResult (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:198:33)
at getTopLevelDeclarations (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:126:15)
at getResult (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:152:17)
at getTopLevelDeclarations (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:126:15)
at Object.generateModuleDeclarationFile (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:49:17)
at Object.<anonymous> (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:54:24)
at Module._compile (module.js:570:32)
When a library can't load, we should still be able to generate something so that we can use this tool in lieu of explaining everything about how to set up a correct DefinitelyTyped folder
See title
I just tried to generate a .d.ts file for redux-actions and I got the following exception:
Unexpected crash! Please log a bug with the commandline you specified.
C:\Users\ME\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:107
throw e;
^
TypeError: undefined is not a function
at Object.<anonymous> (C:\Users\ME\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:83:23)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Is there anything I can do to fix this issue?
with an option to specify an output directory and name?
Thanks
The links in this section of the readme are broken:
https://github.com/Microsoft/dts-gen#note-browser-support-in-progress-this-is-not-quite-ready-yet
dts-gen -m scrollmagic
Unexpected crash! Please log a bug with the commandline you specified.
/usr/local/lib/node_modules/dts-gen/bin/lib/run.js:120
throw e;
^
ReferenceError: window is not defined
at /Users/mike/Documents/viewboard/node_modules/scrollmagic/scrollmagic/uncompressed/ScrollMagic.js:37:2
at /Users/mike/Documents/viewboard/node_modules/scrollmagic/scrollmagic/uncompressed/ScrollMagic.js:22:20
at Object. (/Users/mike/Documents/viewboard/node_modules/scrollmagic/scrollmagic/uncompressed/ScrollMagic.js:27:2)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
Automatic type induction is available in typescript. Is there a plan to support a subset rules such as string, number, and especially, React.component. e.g. I have to addextends React.Component<any,any>
manually to make VScode not complain about the react component class used as .
I installed dts-gen with
sudo npm install -g dts-gen
then I ran
dts-gen
Unexpected crash! Please log a bug with the commandline you specified.
/usr/local/lib/node_modules/dts-gen/bin/lib/run.js:109
throw e;
^Error
at ArgsError.Error (native)
at new ArgsError (/usr/local/lib/node_modules/dts-gen/bin/lib/run.js:25:28)
at Object. (/usr/local/lib/node_modules/dts-gen/bin/lib/run.js:39:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
> npm ---version
3.10.8
> node --version
v6.8.1
> cat /etc/issue
Ubuntu 16.10 \n \l
Is there a way to use the tool in a way similar to that:
import gen from 'dts-gen';
class MyClass {
m1(){}
m2(){}
...
}
const o = new MyClass()
gen(o)
?
Hi.
I try to get type definition of react-virtual-keyboard and virtual-keyboard libraries. They are installed.
Then I write dts-gen -m react-virtual-keyboard
and get an error:
Error: jQuery requires a window with a document at module.exports (/.../.../node_modules/jquery/dist/jquery.js:31:12) at /.../.../node_modules/virtual-keyboard/dist/js/jquery.keyboard.js:2899:2 at $.keyboard.base (/.../.../node_modules/virtual-keyboard/dist/js/jquery.keyboard.js:36:20) at Object.<anonymous> (/.../.../node_modules/virtual-keyboard/dist/js/jquery.keyboard.js:40:2) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17)
What does it mean?
I tried to use var s = document.createElement('script'); s.src = 'https://unpkg.com/dts-gen/bin/browser-bundle.js'; document.body.appendChild(s);
in browser, but it didn't help me. Perhaps, I did something wrong.
Ran into this today while trying to short-cut writing a typings file. It asked that I log a bug since it was an unexpected crash. If it can be resolved, awesome!
Tried using Windows 10, administrative Powershell and command prompt, both dts-gen and adal-node were loaded globally with npm install -g <module>
.
C:\> dts-gen -m adal-node
Unexpected crash! Please log a bug with the commandline you specified.
dts-gen : C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:107
At line:1 char:1
+ dts-gen -m adal-node
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (C:\Users\<username>...\lib\run.js:107:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
throw e;
^
TypeError: Cannot read property 'url' of undefined
at AuthenticationContext.Object.defineProperty.get
(C:\Users\<username>\AppData\Roaming\npm\node_modules\adal-node\lib\authentication-context.js:109:27)
at C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:272:143
at Array.map (native)
at getClassPrototypeMembers (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:272:75)
at getResult (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:138:17)
at getTopLevelDeclarations (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:126:15)
at getResult (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:198:33)
at getTopLevelDeclarations (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:126:15)
at Object.generateModuleDeclarationFile
(C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:49:17)
at Object.<anonymous> (C:\Users\<username>\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:52:24)
Currently it's pretty manual and we might be missing some corner cases
I'm trying to use the Browser version but https://microsoft.github.io/dts-gen/dts-gen.js
is 404 - I note that its work in progress - but should that 404?
First thing I tried generated a crash::
npm install -g dts-gen
npm install -g antlr4
dts-gen -m antlr4
Versions:
[email protected]
[email protected]
node v6.3.1
npm v3.10.6
Results:
Unexpected crash! Please log a bug with the commandline you specified.
C:\Users\Burt_\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:107
throw e;
^
TypeError: Cannot read property 'sourceName' of undefined
at Lexer.sourceName (C:\Users\Burt_\AppData\Roaming\npm\node_modules\antlr4\Lexer.js:240:21)
at C:\Users\Burt_\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:272:143
at Array.map (native)
at getClassPrototypeMembers (C:\Users\Burt_\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:272:75)
at getResult (C:\Users\Burt_\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:138:17)
at getTopLevelDeclarations (C:\Users\Burt_\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:126:15)
at getResult (C:\Users\Burt_\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:198:33)
at getTopLevelDeclarations (C:\Users\Burt_\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:126:15)
at Object.generateModuleDeclarationFile (C:\Users\Burt_\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\index.js:49:17)
at Object.<anonymous> (C:\Users\Burt_\AppData\Roaming\npm\node_modules\dts-gen\bin\lib\run.js:52:24)
The links in the browser support section is broken. Is this feature being developed?
(function (exports, require, module, __filename, __dirname) {
import {NativeModules, DeviceEventEmitter, Platform} from 'react-native';
^^^^^^
SyntaxError: Unexpected token import
I have a third party library written in ES6, how could I generate typings for this ?
> dts-gen -d -m quill
Unexpected crash! Please log a bug with the commandline you specified.
/usr/local/lib/node_modules/dts-gen/bin/lib/run.js:109
throw e;
^
ReferenceError: document is not defined
at Object.<anonymous> (/Users/eric/Code/foo/node_modules/quill/dist/quill.js:2332:13)
at __webpack_require__ (/Users/eric/Code/foo/node_modules/quill/dist/quill.js:36:30)
at Object.<anonymous> (/Users/eric/Code/foo/node_modules/quill/dist/quill.js:1659:2)
at __webpack_require__ (/Users/eric/Code/foo/node_modules/quill/dist/quill.js:36:30)
at Object.<anonymous> (/Users/eric/Code/foo/node_modules/quill/dist/quill.js:76:15)
at __webpack_require__ (/Users/eric/Code/foo/node_modules/quill/dist/quill.js:36:30)
at Object.defineProperty.value (/Users/eric/Code/foo/node_modules/quill/dist/quill.js:7730:14)
at __webpack_require__ (/Users/eric/Code/foo/node_modules/quill/dist/quill.js:36:30)
at Object.<anonymous> (/Users/eric/Code/foo/node_modules/quill/dist/quill.js:63:19)
at __webpack_require__ (/Users/eric/Code/foo/node_modules/quill/dist/quill.js:36:30)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.