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: Could not find a declaration file for module "garfish" #649

Closed
5 tasks done
librz opened this issue Nov 8, 2023 · 4 comments
Closed
5 tasks done

TypeScript: Could not find a declaration file for module "garfish" #649

librz opened this issue Nov 8, 2023 · 4 comments

Comments

@librz
Copy link

librz commented Nov 8, 2023

Describe the bug

Hi, I just tried out Garfish for the first time. When I was setting up the base app(vite + react + ts) using Garfish, I couldn't' get auto completion.

Here's the message I got in VS Code:

Screenshot 2023-11-08 at 15 58 42

When I navigate to node_modules/garfish/package.json, "types": "./index.d.ts" exists

Screenshot 2023-11-08 at 16 13 44

Seems TS can find the type declaration file but refuse to use it.

I manually added "types": "./index.d.ts" under exports and the TS error in VS Code is gone (no red underline anymore):

Screenshot 2023-11-08 at 16 14 30 Screenshot 2023-11-08 at 16 17 01

However I still couldn't get auto completion when I do Garfish.. So I looked it up in the declaration file and realized it depends on @garfish/core which has similar problem.

Screenshot 2023-11-08 at 16 21 31

So I manually added it again (this time to node_modules/@garfish/core/package.json):

Screenshot 2023-11-08 at 16 22 14

Auto completion is working (I have to restart VS Code though):

Screenshot 2023-11-08 at 16 25 05

I suspect all the other @garfish dependencies have the same issue as well.

Screenshot 2023-11-08 at 16 26 24

Reproduction

TypeScript issue, please refer to bug description

Used Package Manager

npm

System Info

System:
    OS: macOS 13.5.2
    CPU: (12) arm64 Apple M2 Pro
    Memory: 5.38 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
  Browsers:
    Chrome: 119.0.6045.105
  npmPackages:
    garfish: ^1.17.1 => 1.17.1

TypeScript: ^5.0.2 => 5.2.2

VS Code: 1.84.1 (arm64)

Validations

@librz librz changed the title Could not find a declaration file for module "garfish" TypeScript: Could not find a declaration file for module "garfish" Nov 8, 2023
@zhoushaw
Copy link
Member

zhoushaw commented Nov 8, 2023

Could you please help to propose an mr To add the relevant content configuration? I can't reproduce it

@librz
Copy link
Author

librz commented Nov 8, 2023

Could you please help to propose an mr To add the relevant content configuration? I can't reproduce it

I'm back at home & created a demo project in my home computer & still can reproduce the issue.

Here's the repo: https://github.com/librz/reprod-garfish-ts-error

Below is a video recording of what happened & how can it be fixed:

reproduce_garfish_ts_error.mov

@zhoushaw
Copy link
Member

Thanks for the feedback, I will fix the problem as soon as possible

@zhoushaw zhoushaw mentioned this issue Nov 20, 2023
6 tasks
@zhoushaw
Copy link
Member

Upgrade to the latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants