turbo
turbo copied to clipboard
Typescript autoimport suggestion not working
What version of Turborepo are you using?
1.0.15
Describe the Bug
Import suggestion from Typescript are not working, unless you have the packages with an empty import (import {} from 'ui'
)
Expected Behavior
Typescript should recognize the packages from the monorepo.
To Reproduce
- Start a new project with
npx create-turbo@latest
or clone an example (I cloned the design system) - Open the index.tsx (or any file from the apps)
- Remove the import statement of one shared component
- Try to auto import it from IDE
I had this error using npm@6. upgrade my node to 16 and it worked
Yeah, I'm using nvim in an environment with node 16 and it doesn't show the error, but the import is still not working.
Updated the description to better explain the issue.
It works if I put ../../packages/**/*.tsx
on web/tsconfig.json
for example.
But then the import is import { Button } from "../../../packages/ui";
instead of import { Button } from 'ui'
;
Got it working... You need to add "references": [{ "path": "../../packages/PACKAGE_NAME" }]
on tsconfig.json
of every package that you want to use PACKAGE_NAME.
@igor-ribeiro could you show me an example of tsconfig.json
for the package you want to use and the tsconfig.json
for the package in which you want to import it? it's not working out of the box for me even after setting composite: true
in the package i want to reference
@fabrixiop26 I'm using the examples from here, so it's the same tsconfig.json
.
I can only get this working for actual code, not types. Anyone find a solution for this?
wanting to bump this and see if anyone has figured this piece out!
@sghsri Can you try again with our updated examples? We believe that those should work for tsconfig sharing as well as types in VSCode.
Our recent example updates have fixed this!