Why is VSCode intellisense/auto-import between packages using relative paths? #7629
Unanswered
colemahatmccreary
asked this question in
Help
Replies: 2 comments 4 replies
-
Do you have a reproduction we could look at? |
Beta Was this translation helpful? Give feedback.
4 replies
-
For others struggling with solutions to this, in my SO answer here I detail how you can fix this without declaration files or using the tsconfig There are more details to the conditions for getting this working in the full answer in the link. I also added |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I've set up a new monorepo following the quickstart guide, scaffolding from the 'basic' example.
After installing, I initialize a new package named @myrepo/types (
packages/types
), and export several TS types from it, including one namedTransaction
.I then initialize a second package named @myrepo/lib (
packages/lib
), and add"@myrepo/types": "*"
as a dependency.In
packages/lib/index.ts
, I then declare the following variable, without first importingTransaction
manually:Following this pattern, I would expect intellisense to have displayed an option for auto-importing
Transaction
from@myrepo/types
when annotating thenew_transaction
variable. Instead, it shows an option to auto-import from../types
(using a relative path instead of "package syntax").However if i manually write
import {Transaction} from "@myrepo/types"
, things still work fine, so this seems to be an arbitrary choice made by VSCode.I'd prefer the package import syntax, so how do I ensure intellisense/autoimport uses the local package syntax (
import {} from "@myrepo/types"
) "by default rather than relative paths?Am I missing something here?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions