Closed
Description
I am using an nx angular project and have the following path in the tsconfig.base.json
"@libs/util/shared": ["libs/util/shared/src/index.ts"],
then in a ts file this
import {
getDefaultConfirmationDialogConfig,
getDefaultDialogConfig,
IIsReloadNeeded
} from '@libs/util/shared';
which results in this error Cannot find module '@libs/util/shared' or its corresponding type declarations
but changing it to relative path works without issues.
import {
getDefaultConfirmationDialogConfig,
getDefaultDialogConfig,
IIsReloadNeeded
} from '../../../../../../../../../../libs/util/shared/src';
I am using
"@typescript/native-preview": "^7.0.0-dev.20250522.2",
and the vscode extension
Identifier
typescriptteam.native-preview
Version
0.20250522.2
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
jakebailey commentedon May 22, 2025
Are you using
baseUrl
to make this work?baseUrl
is not supported; you'll want to remove it and write that path mapping target relative to the tsconfig that it's in instead, e.g.:Or similar, which has worked since TS 4.1.
mikerudge commentedon May 22, 2025
I am getting the same thing. using the vscode extension but tsgo seems ok with it.
jhorgan24 commentedon May 22, 2025
I'm having similar problems with remapping paths. Our config has
"paths": { "@/*": [ "./src/*" ] }
If I try to import
import { prisma } from '@/db';
I getCannot find module '@/db' or its corresponding type declarations.
I've tried adding an explicit path for
@/db
and I've tried without the @ symbol but I get the same result.kbrilla commentedon May 23, 2025
This is how whole NX Monorepo works, so there will be a lot of people having this issue.
kbrilla commentedon May 23, 2025
Tried this one, finally correct autocompletes so thats awesome! But still does not work with ts-go
michaelschufi commentedon May 23, 2025
I'm experiencing the same issue with the VS Code extension. I have not yet updated the typescript version inside the project, as that is not the goal right now.
We are using the following tsconfig file hierarchy.
Yes, we are using baseUrl, but with
${configDir}
so I'm unsure if that's correct or not.and finally the project's tsconfig.json
(I cannot at this time verify if the CLI is working, as there seems to be some different problem with that on my machine right now.)
mikerudge commentedon May 24, 2025
It looks like mine is due to me using () in my paths.
#932
eurmn commentedon May 25, 2025
Same here, paths are resolved in all files but those in which the path contains parenthesis.
PeterStaev commentedon May 28, 2025
I'm also having the problem and the paths do not have parenthesis around them. When I inspect the output of the TS server, I note that despite using relative URLs, it tries to resolve the paths always in the
node_modules
folder of the directory and its parent directories. It never tries to resolve it outside thenode_modules
folder.jakebailey commentedon Jun 4, 2025
Is this still happening for people as of the most recent nightly? The parens thing has been fixed, as have many other module resolution errors.
michaelschufi commentedon Jun 4, 2025
I can confirm that the path resolution errors with my config (#910 (comment)) are completely gone :D 🙏
There are still some other module resolution inconsistencies with the current non-native version, but those cases are not related to
compilerOptions.paths
- at least for me.jakebailey commentedon Jun 4, 2025
I'll close this, then. Please open new issues for anything else you're finding.