microsoft / microsoft/DefinitelyTyped-tools

document is not defiend error with generating types for svgedit

Open
#1,148 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
423
Forks
237
Avg merge
18h 18m
Merged PRs (30d)
11

Description

Error when generating types for SVGEdit:

npm install -g svgedit
dts-gen -m svgedit

Output:

Unexpected crash! Please log a bug with the commandline you specified.
file:///D:/Source/Repos/svgedit-page/node_modules/svgedit/dist/editor/Editor.js:1
 const Tr={type:"logger",log(Tr){this.output("log",Tr)},warn(Tr){this.output("warn",Tr)},error(Tr) 
{this.output("error",Tr)},output(Tr,Ur){console&&console[Tr]&&console[Tr].apply(console,Ur)}};class 
Logger{constructor(Tr){let Ur=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(Tr,Ur)}init(Ur) 
{let Rr=arguments.length>1&&void 0!==arguments[1]?arguments[1]: 
{};this.prefix=Rr.prefix||"i18next:",this.logger=Ur||Tr,this.options=Rr,this.debug=Rr.debug}log(){for(var 
Tr=arguments.length,Ur=new Array(Tr),Rr=0;Rr<Tr;Rr++)Ur[Rr]=arguments[Rr];return 
this.forward(Ur,"log","",!0)}warn(){for(va
...
ReferenceError: document is not defined
at file:///D:/Source/Repos/svgedit-page/node_modules/svgedit/dist/editor/Editor.js:1:58902
at ModuleJobSync.runSync (node:internal/modules/esm/module_job:395:35)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:360:47)
at loadESMFromCJS (node:internal/modules/cjs/loader:1385:24)
at Module._compile (node:internal/modules/cjs/loader:1536:5)
at Object..js (node:internal/modules/cjs/loader:1706:10)
at Module.load (node:internal/modules/cjs/loader:1289:32)
at Function._load (node:internal/modules/cjs/loader:1108:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported npm install -g svgedit and dts-gen -m svgedit commands, then inspect the stack trace at svgedit/dist/editor/Editor.js, where document is accessed. Trace how dts-gen loads the package and define completion as generating types without the reported ReferenceError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.