-
-
Couldn't load subscription status.
- Fork 126
fix(enhancer): replace $Types.Skip with runtime.Types.Skip #2242
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
Conversation
📝 WalkthroughWalkthroughRemoves automatic alias import for runtime.Types in generated model type files and updates JSON optional field typing to use runtime.Types.Skip directly. The statements array now starts empty, and any reference to $Types.Skip is replaced with runtime.Types.Skip. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks (5 passed)✅ Passed checks (5 passed)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. ✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/schema/src/plugins/enhancer/enhance/index.ts (1)
615-630: Guard against missingruntimeimport in model files.Relying on the generator’s existing
import type * as runtime …is fine, but to make this resilient across Prisma versions, opportunistically add a type-onlyruntimeimport if it’s absent.Apply this diff near the
statementsinitialization:- const statements: (string | StatementStructures)[] = []; + const statements: (string | StatementStructures)[] = []; + // Ensure `runtime` is available for type positions if the generated file doesn't import it + const runtimeImport = sf + .getImportDeclarations() + .find((d) => /\/runtime\/library$/.test(d.getModuleSpecifierValue()) || d.getModuleSpecifierValue().includes('@prisma/client/runtime/library')) + ?.getModuleSpecifierValue() ?? undefined; + if (!runtimeImport) { + statements.push(`import type * as runtime from "@prisma/client/runtime/library";`); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/schema/src/plugins/enhancer/enhance/index.ts(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-test (20.x)
- GitHub Check: OSSAR-Scan
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: dependency-review
- GitHub Check: build-test (20.x)
- GitHub Check: build-test (20.x)
🔇 Additional comments (4)
packages/schema/src/plugins/enhancer/enhance/index.ts (4)
615-615: Removing$Typesalias is the right call to avoid TS1380 with type-only runtime imports.Initializing
statementswithout injectingimport $Types = runtime.Typesis correct for Prisma 6.16+ whereruntimeis imported as type-only.
1035-1035: Switching toruntime.Types.Skipaligns with type-only runtime import.This avoids aliasing a type-only import and fixes TS1380.
615-615: Resolved — generated models importruntimeas type-onlyConfirmed: Prisma 6.16.0 "prisma-client" generator emits model files with
import type * as runtime from "@prisma/client/runtime/library"; no change required.
1032-1039: Confirmed: runtime.Types.Skip is present in Prisma 6.16.0 for both generatorsPrisma 6.16.0 generated clients — both the new "prisma-client" and legacy "prisma-client-js" — import from "@prisma/client/runtime/library" and expose the sentinel as runtime.Types.Skip.
Fixes #2240