[Bug] Module does not publish @types for TS usage
zmk-punchbowl opened this issue · 3 comments
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.
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)?
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.
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!