moappi / json2html

Json2html is a lightning fast client side javascript HTML templating library with wrappers for both jQuery and Node.js.

Home Page:https://www.json2html.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facing issues when performing UnitTest using jest

NavyaV01 opened this issue · comments

  • Test suite failed to run
    ReferenceError: json2html is not defined

Declaration:
const json2HTML = require('node-json2html');

*When I hover over the above declaration, it gave me the below pop-up.
Could not find a declaration file for module 'node-json2html'. '/Users/…/node_modules/node-json2html/node.json2html.js' implicitly has an 'any' type.
Try npm i --save-dev @types/node-json2html if it exists or add a new declaration (.d.ts) file containing declare module 'node-json2html';ts(7016)

I tried executing the cmd npm i --save-dev @types/node-json2html, it gave me below error.
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fnode-json2html - Not found
npm ERR! 404
npm ERR! 404 '@types/node-json2html@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Not sure how do I proceed as I’m new to this.
Would be helpful if you can let me know how can this be resolved.

Thanks,
Navya

Hi Navya,

The node json2html package doesn't support typescript at this time, it's something that we'd like to include if someone is interested in taking a stab at writing a node module for typscript.

Also worth looking at this project and requesting a Typescript definition for json2html https://github.com/DefinitelyTyped/DefinitelyTyped