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

[Bug] Module does not publish @types for TS usage #100

Closed
zmk-punchbowl opened this issue Sep 3, 2021 · 3 comments
Closed

[Bug] Module does not publish @types for TS usage #100

zmk-punchbowl opened this issue Sep 3, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@zmk-punchbowl
Copy link

Describe the bug

I don't know if this is a bug, feature request or a chore, but if I import this module in a TS file, I get the following error:

 TS7016: Could not find a declaration file for module 'react-live-chat-loader'.   Try `npm i --save-dev @types/react-live-chat-loader` if it exists or add a new declaration (.d.ts) 

Trying to run that npm command yields:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2freact-live-chat-loader - Not found
npm ERR! 404 
npm ERR! 404  '@types/react-live-chat-loader@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.

If there is another recommended way to avoid TS7016 with this package, please let me know. Thanks.

@zmk-punchbowl zmk-punchbowl added the bug Something isn't working label Sep 3, 2021
@myleslinder
Copy link
Contributor

Hey @zmk-punchbowl, I haven't experienced that issue in the TS project I'm using this in and I'm unable to reproduce it locally. I think it's likely based on an issue with the install or tsconfig. Does the warning persist after a reload of the vscode window and/or restarting the TS server and/or running yarn add react-live-chat-loader (or equivalent for your package manager)?

@zmk-punchbowl
Copy link
Author

Hey @zmk-punchbowl, I haven't experienced that issue in the TS project I'm using this in and I'm unable to reproduce it locally. I think it's likely based on an issue with the install or tsconfig. Does the warning persist after a reload of the vscode window and/or restarting the TS server and/or running yarn add react-live-chat-loader (or equivalent for your package manager)?

Yes, it does persist, and it wasn't just in VSCode, but also came up as an error when running the app itself. This is our tsconfig:

{
  "compilerOptions": {
    "baseUrl": ".",
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "isolatedModules": true,
    "jsx": "react",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "module": "esnext",
    "moduleResolution": "node",
    "noEmit": true,
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": false,
    "noUnusedParameters": true,
    "preserveConstEnums": true,
    "removeComments": false,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "strict": true,
    "target": "es5"
  },
  "exclude": [
    "node_modules"
  ],
  "include": [
    "src",
    "**/*.d.ts",
    "**/*.ts",
    "**/*.tsx"
  ]
}

We ended up solving it by adding a .d.ts file.

@benschwarz
Copy link
Member

Looks like this one is solved for now (Thanks for helping out @myleslinder!).

I'm closing this issue off but if anything comes up be sure to let us know.

Thanks for documenting the fix @zmk-punchbowl!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants