Skip to content

Error compiling generated code #2124

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

Closed
draylegend opened this issue May 20, 2025 · 5 comments
Closed

Error compiling generated code #2124

draylegend opened this issue May 20, 2025 · 5 comments

Comments

@draylegend
Copy link

Error:

$ zenstack generate
⌛️ ZenStack CLI v2.14.2, running plugins
 Generating Prisma schema
 Generating PrismaClient enhancer
 Generating Zod schemas
Error compiling generated code:
node_modules/bun-types/bun.d.ts:6977:5 - error TS1139: Type parameter declaration expected.

6977     const In extends SpawnOptions.Writable = "ignore",
         ~~~~~
node_modules/bun-types/bun.d.ts:6977:14 - error TS1005: ',' expected.

6977     const In extends SpawnOptions.Writable = "ignore",
                  ~~~~~~~
node_modules/bun-types/bun.d.ts:6977:34 - error TS1005: ',' expected.

6977     const In extends SpawnOptions.Writable = "ignore",
                                      ~
node_modules/bun-types/bun.d.ts:6978:15 - error TS1005: ',' expected.

6978     const Out extends SpawnOptions.Readable = "pipe",
                   ~~~~~~~
node_modules/bun-types/bun.d.ts:6978:35 - error TS1005: ',' expected.

6978     const Out extends SpawnOptions.Readable = "pipe",
                                       ~
node_modules/bun-types/bun.d.ts:6979:15 - error TS1005: ',' expected.

6979     const Err extends SpawnOptions.Readable = "inherit",
                   ~~~~~~~
node_modules/bun-types/bun.d.ts:6979:35 - error TS1005: ',' expected.

6979     const Err extends SpawnOptions.Readable = "inherit",
                                       ~
node_modules/bun-types/bun.d.ts:6980:3 - error TS1109: Expression expected.

6980   >(
       ~
node_modules/bun-types/bun.d.ts:6981:12 - error TS1005: ')' expected.

6981     options: SpawnOptions.OptionsObject<In, Out, Err> & {
                ~
node_modules/bun-types/bun.d.ts:6996:19 - error TS1011: An element access expression should take an argument.

6996       cmd: string[]; // to support dynamically constructed commands
    

: Error compiling generated code

package.json:

{
  "name": "prisma",
  "type": "module",
  "private": true,
  "devDependencies": {
    "@types/bun": "1.2.13",
    "prisma": "6.8.2",
    "zenstack": "2.14.2"
  },
  "dependencies": {
    "@prisma/client": "6.8.2",
    "@zenstackhq/runtime": "2.14.2"
  },
  "devDependencies": {
    "typescript": "5.8.3"
  }
}
@draylegend
Copy link
Author

it would also be really handy if bunx zenstack init would use bun to install the deps

@ymc9
Copy link
Member

ymc9 commented May 20, 2025

I honestly don't know what's going on with bun here ... ZenStack uses ts-morph to generate TS code and compile. The errors seem to indicate somehow an older version of tsc is used so new generics syntax is not recognized, but I don't know how and why bun interferes with ts-morph ...

@ymc9
Copy link
Member

ymc9 commented May 20, 2025

It seems to work when I explicitly set tsconfig's "compiler.types" to an empty array. Will attempt a fix.

ymc9 added a commit that referenced this issue May 21, 2025
- explicitly pass "types": [] to tsconfig to avoid bun compilation errors
- detect bun as package manager

fixes Error compiling generated code #2124
@ymc9 ymc9 closed this as completed May 21, 2025
@draylegend
Copy link
Author

Absolutely thrilled with the seamless functionality of the init and generate arguments—everything operates flawlessly!
The swift deployment of bun support was an unexpected delight.

@ymc9
Copy link
Member

ymc9 commented May 21, 2025

Thank you for confirming it works. I'm glad you pushed for it!

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

No branches or pull requests

2 participants