Skip to content

Types for TypeScript #19

Open
Open

Description

@raine

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';`

Activity

  1. Janpot commented on Jul 8, 2020

    @Janpot
    Owner

    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.

  2. raine commented on Jul 8, 2020

    @raine
    Author

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

  3. raine commented on Jul 8, 2020

    @raine
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions