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

tsc --noEmit does not detect issues in react-ts template #17585

Closed
7 tasks done
JElgar opened this issue Jun 28, 2024 · 4 comments
Closed
7 tasks done

tsc --noEmit does not detect issues in react-ts template #17585

JElgar opened this issue Jun 28, 2024 · 4 comments

Comments

@JElgar
Copy link

JElgar commented Jun 28, 2024

Describe the bug

After adding type errors in project tsc not showing any errors when run (npx tsc -w) in react-ts template.

Reproduction

https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts

Steps to reproduce

  1. Clone https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts or open https://vite.new/react-ts
  2. Open src/main.tsx and add const a: string = 2 somewhere
  3. Run npx tsc --noEmit

tsc will say there is no issue (when it should be complaining about the line we just added

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @vitejs/plugin-react: ^4.3.1 => 4.3.1 
    vite: ^5.3.1 => 5.3.2

Used Package Manager

npm

Logs

~/projects/vitejs-vite-whkhm3 2s
❯ npx tsc --noEmit

^ there is no output

Validations

@sapphi-red
Copy link
Member

sapphi-red commented Jun 29, 2024

You need to run tsc -b instead of tsc --noEmit.

But that might be not intuitive. Maybe this could be one reason to revert #15913 and merge the tsconfigs (#15913).

@MehYam
Copy link

MehYam commented Jul 2, 2024

Probably just repeating OP here, but the same holds for those of us using tsc -w as our compile error monitor. I just created a new Typescript + React project with npm create vite@latest, and tsc -w seems to have trouble unless I merge the tsconfigs myself.

@JElgar
Copy link
Author

JElgar commented Jul 10, 2024

You need to run tsc -b

Thanks that does the trick!

But that might be not intuitive

I agree, having a root tsconfig with no included files and then 2 tsconfigs both marked with no emit takes a bit of getting used to. That being said I'm not super familiar with this stuff so that might just be me.

@bluwy
Copy link
Member

bluwy commented Jul 23, 2024

Closing this as the issue is of the missing -b flag not passed, and not an issue with the template in general. However, we have been discussing and working on removing the "solutions" setup, which had caused other confusions like #17638

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants