Closed rrichardson closed 2 years ago
Yeah - that seems pretty annoying. Changing the name makes sense.
Buggered it up a bit - but slight issue is that it's not going to be possible to rename to oxide-ts due to being too similar to the original package name. Thoughts?
This error only gets reported when the import failed to resolve to anything—expected if, e.g., someone had written this before running npm install
. If you’re getting it in a project that’s fully set up, it means the package isn’t resolving correctly and renaming it will only trade this error for the standard Cannot find module '{0}' or its corresponding type declarations
error. You can run tsc --traceResolution
to get a log of where the compiler looked to try to find typings. I wonder if this is a problem: https://github.com/traverse1984/oxide-ts/blob/4a3ff234ba9928fa151a998f7ad5d7f359c31be2/package.json#L6
We usually see this pointing to a file, not a directory relying on index-file resolution. I would have thought that index-file resolution does work here, but I can’t remember for sure off the top of my head. Anyway, --traceResolution
will tell you. Point is, this is not a bug in tsc and the package does not need to be renamed to fix it. There are other npm packages whose name ends in .ts
that work fine too.
Thanks so much for your reply Andrew, clearly I'd misunderstood the problem. @rrichardson Does this resolve your issue?
When using oxide.ts in the latest (anything after 4.2) typescript, I get this error:
IMO it's a bug in tsc, because I'm not trying to import a local file, but a module instead, which should be obvious from the lack of local path separator.
There are a bunch of people complaining about this, also Deno requires file extensions, instead of banning them. I think this restriction will be lifted, but either way, to avoid current and future errors, would you consider renaming
oxide.ts
tooxide-ts
?see: https://github.com/microsoft/TypeScript/issues/38149 https://github.com/microsoft/TypeScript/issues/37582 https://github.com/microsoft/TypeScript/issues/44839