baseUrl: "./" confuses VSCode and Jest (and me) #133
Labels
kind: support
Asking for support with something or a specific use case
solution: duplicate
This issue or pull request already exists
solution: workaround available
There is a workaround available for this issue
topic: TS Paths Aliases
Related to using aliases with TypeScript paths
Milestone
Current Behavior
When editing a file like
src/middleware/healthCheck.ts
, and having VS Code automatically import something from another file (src/util/checkHttpMethod.ts
) based on autocomplete, VS Code will generate a statement like:However, this appears to be incorrect.
When the compiler runs (from
npm start
, ie.tsdx watch
), it will say the following:And worse yet, when I run
npm test
with a test that tries loadingsrc/middleware/healthCheck.ts
, it will fail with this error message.Everything works fine if I switch the import statement to use a relative path like this:
Expected behavior
I would have expected things to "just work" - ie. VS Code reads the tsconfig.json and is able to figure out the right path when importing files.
Suggested solution(s)
I'm not sure I understand what the
baseUrl: "./"
setting is supposed to do, so I don't have any immediate suggestions. Maybe I'm just doing it wrong?Additional context
The test in question lives in
test/middleware/healthCheck.test.ts
and has this import statement:Your environment
The text was updated successfully, but these errors were encountered: