Closed mukulgupta21 closed 11 months ago
I'm currently preparing a hybrid package that can cope with the needs of both worlds. I'll add this to master in the next few days. Thanks for your PR. I'll leave it open and let you check the changes.
Hi.
I published version 4.0.0 which should be able to copy with the need of both worlds. Could you please give this a shot and get back to me in any case of an error.
Thanks
I tried using the latest version got the folllowing error.
error TS7016: Could not find a declaration file for module 'tabletojson'. '/working-directory/tabletojson/dist/lib/mjs/Tabletojson.js' implicitly has an 'any' type.
There are types at '/my-project/node_modules/tabletojson/@typings/Tabletojson.d.ts', but this result could not be resolved when respecting package.json "exports". The 'tabletojson' library may need to update its package.json or typings.
1 import { Tabletojson as tabletojson } from 'tabletojson';
Can you please check?
Like displayed in the issue here: https://stackoverflow.com/questions/58211880/uncaught-syntaxerror-cannot-use-import-statement-outside-a-module-when-import I would like to ask you to create a small project I can fork which has the problems. It is clear, that typings
and types
are equivalent and can both be used.
I tested it in a test project I created, everything worked.
But as far as I see this is a problem which is not as easy to be solved: https://github.com/microsoft/TypeScript/issues/52363#issuecomment-1659227177 and https://gist.github.com/andrewbranch/79f872a8b9f0507c9c5f2641cfb3efa6
So, as far as I can see, the problem is the module resolution with nodenext. For now I cannot see a solution for this behavior despite the fact that I would have to create a second library for nodenext.
Thanks @maugenst for reverting back. Here is a link to a toy project. Simply run npm run compile
to reproduce the issue.
I'll have a look and get back to you...
With version 4.0.1 I changed the type exports. I tested it with your project and it worked. Could you please verify?
Thank you. It works with my project. Appreciate your prompt response!
Strange that "types" and "typings" are not synonymous as claimed by the documentation. Must be a tsc
bug with nodenext
resolution.
I'll close the pull request.
Background context: I was trying to use
tablejson
inside my project which uses themoduleResolution
asnodenext
and the package complained with typescript errors. On investigation, I found out that@types/cheerio
was no longer needed with the latestcheerio
package as it supplied its own types. Adding the .js extension while importing modules, although unintuitive, is a more future proof way while maintaining backward compatibility.Let me know if this can be included.