question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with NodeList in index.d.ts in node.js project

See original GitHub issue

I have a node.js based TypeScript project. ohm is installed using npm. Running tsc -p throws an error: node_modules/ohm-js/index.d.ts(39,16): error TS2304: Cannot find name 'NodeList'.

I guess because NodeList is browser specific. Commenting out the grammarFromScriptElements function signature in index.d.ts makes it compile again.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Gamadrilcommented, May 3, 2018

That would be great.

2reactions
pdubroycommented, May 3, 2018

Hmm, ok. So for your use case, you’d prefer that the Ohm definitions don’t refer to any types from the DOM library, right?

I think maybe the solution is to do something similar to what ProtoBuf.js does: you should be able to choose to use a subset of the API that doesn’t include any browser-related features. E.g., import * as ohm from 'ohm-js/no-dom';.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node_modules/@types/node/index.d.ts(20,1): error TS1084
My solution is to change typescript version to '>=2.7.3'. I think the version might depend on other packages. probably need to try a...
Read more >
A Complete Guide to Using TypeScript in Node.js - Better Stack
JavaScript library authors can ensure that their packages are type-checked when utilized in a TypeScript project by providing type declaration files ( .d.ts...
Read more >
NodeList - Web APIs | MDN
Chrome Edge Fir... NodeList Full support. Chrome1. Toggle history Full support. Edge12. Toggle history Fu... @@iterator Full support. Chrome51. Toggle history Full support. Edge79. Toggle...
Read more >
types/jsdom/index.d.ts - UNPKG
* The built-in `vm` module of Node.js is what underpins JSDOM's script-running magic. 49, * Some advanced use cases, like pre ...
Read more >
Web Scraping with TypeScript and Node.js - This Dot Labs
For simplicity, we'll create an index.ts file in the project root to ... project # install dependencies npm install typescript ts-node npm ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found