Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types for TypeScript #19

Open
raine opened this issue Jul 8, 2020 · 3 comments
Open

Types for TypeScript #19

raine opened this issue Jul 8, 2020 · 3 comments

Comments

@raine
Copy link

raine commented Jul 8, 2020

You added some kind of types in 7444207 but they don't seem to be available when using this module from TypeScript.

error TS7016: Could not find a declaration file for module 'microdata-node'. 'node_modules/microdata-node/src/index.js' implicitly has an 'any' type.
  Try `npm install @types/microdata-node` if it exists or add a new declaration (.d.ts) file containing `declare module 'microdata-node';`
@Janpot
Copy link
Owner

Janpot commented Jul 8, 2020

Can you try to enable checkJs in your tsconfig.json? For now the types are strictly internal, I'm not sure I want to introduce a build step at this point.

@raine
Copy link
Author

raine commented Jul 8, 2020

No effect. I wonder if that setting applies only to project files and not dependencies.

@raine
Copy link
Author

raine commented Jul 8, 2020

This worked:

"include": ["node_modules/microdata-node/src/**/*.js"]

Looks like config is incorrectly defined as required parameter to toJson. It's optional in README.

scripts/run.ts:21:39 - error TS2554: Expected 2 arguments, but got 1.

21     require('util').inspect(microdata.toJson(html), {
                                         ~~~~~~~~~~~~~~~~~~

  node_modules/microdata-node/src/index.js:59:33
    59 function toJson (microdataHtml, config) {
                                       ~~~~~~
    An argument for 'config' was not provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants