Suggestion
π Search Terms
module resolution, helpful error, helpful errors, 2307, paths
β
Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Show the path(s) where TypeScript tried to search for a file to aid getting to the right path
π Motivating Example
import { wow } from '../../../a';
Error -
Cannot find module '../../../a' or its corresponding type declarations.ts(2307)
With this suggestion implemented, it will show -
Cannot find module '../../../a' or its corresponding type declarations.ts(2307)
Tried -
/users/PhistucK/projects/trial/src/a
/users/PhistucK/projects/trial/polka/polka/polka/a
Could also show the searched file extensions, might be verbose but sometimes helpful -
/users/PhistucK/projects/trial/src/a.ts
/users/PhistucK/projects/trial/src/a.tsx
/users/PhistucK/projects/trial/src/a.js
/users/PhistucK/projects/trial/src/a.jsx
/users/PhistucK/projects/trial/src/a.mjs
/users/PhistucK/projects/trial/polka/polka/polka/a.ts
/users/PhistucK/projects/trial/polka/polka/polka/a.tsx
/users/PhistucK/projects/trial/polka/polka/polka/a.js
/users/PhistucK/projects/trial/polka/polka/polka/a.jsx
/users/PhistucK/projects/trial/polka/polka/polka/a.mjs
π» Use Cases
Sometimes IntelliSense/your editor/your brain does not know what exactly is wrong (another ../? an extraneous ../?) because it is not so apparent what is the resulting path. Showing the paths that TypeScript searched in that did not have that file would go a long way in aiding the user with getting to the right path.
I find myself a lot of times with such a vague error message that is not helpful and it is a trial and error, adding one more ../, removing it, looking at the path of the file and re-calculating the number of ../ and so on.
../ is not the only problem, though, it is just an example.
Ideally, the user input and the path-completion would be shown in two different colors in order to show where the user is wrong (maybe it was not the ../, maybe it was a case sensitivity issue, a dash or whatever, maybe even both of them), or where the search paths are incorrect (a user error, but not necessarily an error in that specific import path).
Obviously, since ../ will not actually show up in the resulting path, it is fine (and necessary) not to artificially add it to the resulting path just for showing the original user input in the resulting path.
The context is that I see this error within Visual Studio Code, not sure whether other places where this error is emitted show this information or not...
Suggestion
π Search Terms
module resolution, helpful error, helpful errors, 2307, paths
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Show the path(s) where TypeScript tried to search for a file to aid getting to the right path
π Motivating Example
import { wow } from '../../../a';Error -
Cannot find module '../../../a' or its corresponding type declarations.ts(2307)With this suggestion implemented, it will show -
Could also show the searched file extensions, might be verbose but sometimes helpful -
π» Use Cases
Sometimes IntelliSense/your editor/your brain does not know what exactly is wrong (another ../? an extraneous ../?) because it is not so apparent what is the resulting path. Showing the paths that TypeScript searched in that did not have that file would go a long way in aiding the user with getting to the right path.
I find myself a lot of times with such a vague error message that is not helpful and it is a trial and error, adding one more ../, removing it, looking at the path of the file and re-calculating the number of ../ and so on.
../ is not the only problem, though, it is just an example.
Ideally, the user input and the path-completion would be shown in two different colors in order to show where the user is wrong (maybe it was not the ../, maybe it was a case sensitivity issue, a dash or whatever, maybe even both of them), or where the search paths are incorrect (a user error, but not necessarily an error in that specific import path).
Obviously, since ../ will not actually show up in the resulting path, it is fine (and necessary) not to artificially add it to the resulting path just for showing the original user input in the resulting path.
The context is that I see this error within Visual Studio Code, not sure whether other places where this error is emitted show this information or not...