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

bug: vue-tsc errors #5723

Closed
1 task
lacherogwu opened this issue May 15, 2024 · 7 comments
Closed
1 task

bug: vue-tsc errors #5723

lacherogwu opened this issue May 15, 2024 · 7 comments
Labels

Comments

@lacherogwu
Copy link

lacherogwu commented May 15, 2024

Provide environment information

 System:
    OS: macOS 14.4.1
    CPU: (14) arm64 Apple M3 Max
    Memory: 3.46 GB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    pnpm: 9.1.0 - ~/.nvm/versions/node/v20.12.2/bin/pnpm
  Browsers:
    Chrome: 124.0.6367.203
    Safari: 17.4.1
  npmPackages:
    @trpc/client: ^10.45.2 => 10.45.2 
    typescript: ^5.2.2 => 5.4.5 

Describe the bug

When using vue-tsc for linting, I'm encountering errors from the node_modules within my server, as well as type errors related to the server. However, I'm only linting the client-side code.

here are example of the errors

> vue-tsc

../server/node_modules/amazon-sp-api/lib/typings/operations/catalogItems.ts:44:11 - error TS6196: 'IdentifierType' is declared but never used.

44 interface IdentifierType {
             ~~~~~~~~~~~~~~

../server/node_modules/amazon-sp-api/lib/typings/operations/catalogItems.ts:83:11 - error TS6196: 'AttributeSet' is declared but never used.

83 interface AttributeSet {
             ~~~~~~~~~~~~

../server/node_modules/amazon-sp-api/lib/typings/operations/catalogItems.ts:182:11 - error TS6196: 'Relationship' is declared but never used.

182 interface Relationship {
              ~~~~~~~~~~~~

../server/node_modules/amazon-sp-api/lib/typings/operations/catalogItems.ts:207:11 - error TS6196: 'SalesRank' is declared but never used.

207 interface SalesRank {
              ~~~~~~~~~

../server/trpc/router.ts:5:7 - error TS6133: 'a' is declared but its value is never read.

5 const a: string = "";
        ~

../server/trpc/router.ts:7:7 - error TS6133: 'spApi' is declared but its value is never read.

7 const spApi = new SellingPartner({
        ~~~~~


Found 6 errors in 2 files.

Errors  Files
     4  ../server/node_modules/amazon-sp-api/lib/typings/operations/catalogItems.ts:44
     2  ../server/trpc/router.ts:5

Link to reproduction

https://codesandbox.io/p/sandbox/hardcore-goldstine-vhhxrl

To reproduce

Have 2 folders

  • server
  • client (vue typescript app, using npm create vite

install trpc on server & client
install amazon-sp-api
or have any type check error, like unused variable or any else

run vue-tsc on client folder

Additional information

The reason of this error is because we need to import the AppRouter type from the server, which causing the vue-tsc typechecker to include stuff from the server

I've been searching extensively online but couldn't find a solution. I've tried various combinations with the tsconfig to exclude certain files, but nothing has worked so far.

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR fixing this bug!

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar
@KATT
Copy link
Member

KATT commented May 16, 2024

I think you just need skipLibCheck: true

https://www.totaltypescript.com/tsconfig-cheat-sheet

@KATT KATT added the 👻 invalid Invalid bug report label May 16, 2024
@KATT
Copy link
Member

KATT commented May 16, 2024

You will get errors from your server even if you're only type-checking your client, that works as designed.

@lacherogwu
Copy link
Author

As you can see there is skipLibCheck: true in the tsconfig.json, that doesn't help.
and If I would run tsc --noEmit on the server I wouldn't get these errors since I skipLibCheck: true

but still if I run vue-tsc on the client and because of this type import in the client from the server it would print these errors, even though it should ignore (i guess)

@lacherogwu
Copy link
Author

but those who still have this problem and want quick-fix I wrote a small utility that helps to ignore those errors, you can check it here → tsc-exclude

it works great 😇

@KATT
Copy link
Member

KATT commented May 17, 2024

Hey there! 👋

We appreciate the time you've taken to write this issue.

Unfortunately, we don't have the capacity to assist here as this issue does not seem to be related to tRPC itself.

Please feel free to re-open if you disagree or post in our help channels on Discord or in our GitHub Discussions.

@KATT KATT closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
@lacherogwu
Copy link
Author

Yeah I feel you, thanks for your time, I might fill up an issue on typescript it might be the right place

Copy link

This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants