You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript currently cannot detect wouter's types if moduleResolution is set to "node16" or "nodenext".
This seems to be fixed by referencing the type files for each element under exports:
".": {
"types": "./types/ts4.1/index.d.ts",
"require": "some path",
"default": "some path"
},
"/use-location": "same idea as above"
and so on. types has been added. Is this something that could be added safely?
If not, I think the same result is achieved by ensuring that the .d.ts files are located next to their JS counterparts (but they aren't in wouter).
Here's a long discussion about this issue from TypeScript's perspective.
Here's an example of how you're supposed to export subpath types according to Microsoft's module resolution guy.
It's a bit over my head right now, I wish I could explain exactly how it works. 🙂
Also the current package.json seems pretty deliberate so I could be totally wrong.
FWIW it seems like when the modern & upcoming module resolution is enabled, exports takes precedence and it becomes necessary to define the types there too. And it sounds like the new way will be the default eventually.
The text was updated successfully, but these errors were encountered:
Sure, done!
Wasn't sure whether it's the best solution or if you'd want it, but after thinking a bit I don't see what problems it could cause.
Feel free to close this. :-)
TypeScript currently cannot detect wouter's types if
moduleResolution
is set to"node16"
or"nodenext"
.This seems to be fixed by referencing the type files for each element under
exports
:and so on. types has been added. Is this something that could be added safely?
If not, I think the same result is achieved by ensuring that the
.d.ts
files are located next to their JS counterparts (but they aren't in wouter).Here's a long discussion about this issue from TypeScript's perspective.
Here's an example of how you're supposed to export subpath types according to Microsoft's module resolution guy.
It's a bit over my head right now, I wish I could explain exactly how it works. 🙂
Also the current package.json seems pretty deliberate so I could be totally wrong.
FWIW it seems like when the modern & upcoming module resolution is enabled,
exports
takes precedence and it becomes necessary to define the types there too. And it sounds like the new way will be the default eventually.The text was updated successfully, but these errors were encountered: