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

TypeScript: declarations for keycharm #164

Closed
MrManny opened this issue Oct 16, 2019 · 3 comments · Fixed by #240
Closed

TypeScript: declarations for keycharm #164

MrManny opened this issue Oct 16, 2019 · 3 comments · Fixed by #240
Labels
bug Something isn't working help wanted Extra attention is needed released wontfix This will not be worked on

Comments

@MrManny
Copy link

MrManny commented Oct 16, 2019

Greetings,

I have been using vis.js through the vis package in a Vue web application which uses TypeScript exclusively. As that package was EOL, I finally got around to migrate to vis-network 6.1.1.

The transition itself was painless and easy except for one tiny little detail. During the build process, TypeScript complained about this:

ERROR in C:/path-to-my-project/node_modules/vis-network/dist/types/index.d.ts
22:27 Could not find a declaration file for module 'keycharm'. 'C:/path-to-my-project/node_modules/keycharm/keycharm.js' implicitly has an 'any' type.
  Try `npm install @types/keycharm` if it exists or add a new declaration (.d.ts) file containing `declare module 'keycharm';`
    20 | import * as Hammer from './module/hammer';
    21 | export { Hammer };
  > 22 | import * as keycharm from 'keycharm';
       |                           ^
    23 | export { keycharm };
    24 | //# sourceMappingURL=index.d.ts.map

For reference, here is my tsconfig.json:

{
  "compilerOptions": {
    "target": "es2015",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "resolveJsonModule": true,
    "types": [
      "webpack-env",
      "jest"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}

The DefinitelyTyped repository does not appear to contain @types/keycharm, but I could work around the issue by adding "skipLibCheck": true to my tsconfig.json. As such, this is not a critical issue for me. However, I can also be somewhat pedantic and would appreciate a solution to this minor issue. I can also try to take it up with the package owner if you'd prefer that.

@Thomaash
Copy link
Member

Keycharm doesn't have type definitions. You can make this error go away by simply adding declare module "keycharm"; to your type definitions.

It would indeed be better to solve this either in DefinitelyTyped or the Keycharm library itself.

@mojoaxel mojoaxel added the bug Something isn't working label Oct 27, 2019
@mojoaxel
Copy link
Member

We should keep this here open until AlexDM0/keycharm#6 is resolved!

@mojoaxel mojoaxel added help wanted Extra attention is needed wontfix This will not be worked on labels Oct 27, 2019
@vis-bot
Copy link
Collaborator

vis-bot commented Nov 18, 2019

🎉 This issue has been resolved in version 6.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed released wontfix This will not be worked on
Projects
None yet
4 participants