Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript autoimport suggestion not working #331

Closed
igor-ribeiro opened this issue Dec 16, 2021 · 11 comments
Closed

Typescript autoimport suggestion not working #331

igor-ribeiro opened this issue Dec 16, 2021 · 11 comments
Labels
area: ergonomics Issues and features impacting the developer experience of using turbo area: examples Improvements or additions to examples

Comments

@igor-ribeiro
Copy link

igor-ribeiro commented Dec 16, 2021

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')

turborepo-ts-import

Expected Behavior

Typescript should recognize the packages from the monorepo.

To Reproduce

  1. Start a new project with npx create-turbo@latest or clone an example (I cloned the design system)
  2. Open the index.tsx (or any file from the apps)
  3. Remove the import statement of one shared component
  4. Try to auto import it from IDE
@MarcARoberge
Copy link

I had this error using npm@6. upgrade my node to 16 and it worked

@igor-ribeiro
Copy link
Author

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.

@igor-ribeiro igor-ribeiro changed the title Typescript not working Typescript import suggestion not working Dec 16, 2021
@igor-ribeiro
Copy link
Author

Updated the description to better explain the issue.

@igor-ribeiro
Copy link
Author

igor-ribeiro commented Dec 16, 2021

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';

@igor-ribeiro
Copy link
Author

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.

@jaredpalmer jaredpalmer changed the title Typescript import suggestion not working Typescript autoimport suggestion not working Dec 17, 2021
@fabrixiop26
Copy link

@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

@igor-ribeiro
Copy link
Author

@fabrixiop26 I'm using the examples from here, so it's the same tsconfig.json.

@sghsri
Copy link

sghsri commented Jan 23, 2022

I can only get this working for actual code, not types.
Anyone find a solution for this?

image

image

@sghsri
Copy link

sghsri commented Sep 17, 2022

wanting to bump this and see if anyone has figured this piece out!

@nathanhammond
Copy link
Contributor

@sghsri Can you try again with our updated examples? We believe that those should work for tsconfig sharing as well as types in VSCode.

sokra added a commit that referenced this issue Oct 25, 2022
This fixes the `startup` benchmark metric to show the time until first render, instead of being equal to hydration.

It also skips `hydration` for CSR bundlers since it's equal first render for them.

It now correctly measures the initial SSR as `startup`, so CLI start until page visible:
![image](https://user-images.githubusercontent.com/1365881/189152420-396b181b-5a3e-4902-881d-7c247fa43bd8.png)
jridgewell pushed a commit to vercel/next.js that referenced this issue Mar 10, 2023
This fixes the `startup` benchmark metric to show the time until first render, instead of being equal to hydration.

It also skips `hydration` for CSR bundlers since it's equal first render for them.

It now correctly measures the initial SSR as `startup`, so CLI start until page visible:
![image](https://user-images.githubusercontent.com/1365881/189152420-396b181b-5a3e-4902-881d-7c247fa43bd8.png)
sokra added a commit to vercel/next.js that referenced this issue Mar 13, 2023
This fixes the `startup` benchmark metric to show the time until first render, instead of being equal to hydration.

It also skips `hydration` for CSR bundlers since it's equal first render for them.

It now correctly measures the initial SSR as `startup`, so CLI start until page visible:
![image](https://user-images.githubusercontent.com/1365881/189152420-396b181b-5a3e-4902-881d-7c247fa43bd8.png)
@mehulkar mehulkar added area: examples Improvements or additions to examples area: ergonomics Issues and features impacting the developer experience of using turbo owned-by: turborepo labels Oct 20, 2023
@anthonyshew
Copy link
Contributor

Our recent example updates have fixed this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ergonomics Issues and features impacting the developer experience of using turbo area: examples Improvements or additions to examples
Projects
None yet
Development

No branches or pull requests

7 participants