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

Broken reference/return type of enhance missing after running zenstack generate #1687

Open
mloffer opened this issue Sep 5, 2024 · 1 comment

Comments

@mloffer
Copy link

mloffer commented Sep 5, 2024

Description and expected behavior

  1. Create a sample Turborepo project using the "with-prisma" example, instructions here. i.e. pnpm dlx create-turbo@latest --example with-prisma. Be sure to select pnpm for the package manager.
  2. Run pnpm dlx zenstack@latest init from the packages/database workspace to add zenstack.
  3. Modify packages/database/src/client.ts to export PrismaClient from prisma and everything from zenstack.
  4. Modify apps/web/src/app/page.tsx to create an enhanced database client by consuming @repo/database.
  5. Observe the return type of enhance to be any. Navigating to declaration shows the module is missing.

Reproduction can be found here. Note that the runtime executes successfully. However, no typing information is available to IDEs.

Screenshots
image
image

Environment (please complete the following information):

  • ZenStack version: 2.4.1
  • Prisma version: 5.10.2
  • Database type: Postgresql

Additional context

  • Windows 11 23H2
  • Node v22.8.0
  • pnpm v9.9.0
  • Webstorm 2024.2.1
@mloffer
Copy link
Author

mloffer commented Sep 6, 2024

Some updates to this:

  • The same behavior is exhibited in VS Code 1.93.0.
  • The same behavior is exhibited using yarn v1 in place of pnpm.
  • Similar behavior is exhibited for npm: specifically, the "old state" persists, i.e. no new models show up and removed models are still present.
  • Both IDEs can resolve the references properly if you close and restart them (note: this is not a viable workaround)
  • In contrast to ZenStack's enhance, PrismaClient has the proper types resolved every time generate is run (maybe Prisma can provide a clue for a fix?)

@mloffer mloffer changed the title Broken reference/return type of enhance missing under pnpm Broken reference/return type of enhance missing after running generate Sep 6, 2024
@mloffer mloffer changed the title Broken reference/return type of enhance missing after running generate Broken reference/return type of enhance missing after running zenstack generate Sep 6, 2024
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

1 participant