Skip to content

Commit

Permalink
fixed client and model extension types
Browse files Browse the repository at this point in the history
  • Loading branch information
HRM committed Sep 9, 2024
1 parent f868980 commit dfb0f51
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prisma-nitro-patcher",
"version": "0.0.9",
"version": "0.0.10",
"description": "Applies a patch on the prisma client to improve the performance of extensions",
"files": [ "dist" ],
"bin": {
Expand Down
6 changes: 3 additions & 3 deletions src/patchPrisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { PresentableError } from './util';
*/
const extendsHookModified = `
declare type MapExtensionsToClientComposableType<T extends $Extensions.InternalArgs> = {
[K in keyof T["client"]]: T["client"][K]
[K in keyof T["client"]]: ReturnType<T["client"][K]>
}& {
[K in keyof Omit<T["model"],"$allModels">]: {
[O in keyof T["model"][K]]:T["model"][K][O]
} & (T["model"]["$allModels"] extends object?{[O in keyof T["model"]["$allModels"]]:T["model"]["$allModels"][O]}:unknown)
[O in keyof T["model"][K]]:ReturnType<T["model"][K][O]>
} & (T["model"]["$allModels"] extends object?{[O in keyof T["model"]["$allModels"]]:ReturnType<T["model"]["$allModels"][O]>}:unknown)
}
declare interface ExtendsHookModified<Variant extends 'extends' | 'define', TypeMapCb extends $Extensions.TypeMapCbDef, ExtArgs extends Record<string, any>, TypeMap extends $Extensions.TypeMapDef = $Utils.Call<TypeMapCb, {
Expand Down
6 changes: 3 additions & 3 deletions tests/files/ver-5.19.1/index-patched.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import $Extensions = runtime.Types.Extensions
import $Result = runtime.Types.Result

declare type MapExtensionsToClientComposableType<T extends $Extensions.InternalArgs> = {
[K in keyof T["client"]]: T["client"][K]
[K in keyof T["client"]]: ReturnType<T["client"][K]>
}& {
[K in keyof Omit<T["model"],"$allModels">]: {
[O in keyof T["model"][K]]:T["model"][K][O]
} & (T["model"]["$allModels"] extends object?{[O in keyof T["model"]["$allModels"]]:T["model"]["$allModels"][O]}:unknown)
[O in keyof T["model"][K]]:ReturnType<T["model"][K][O]>
} & (T["model"]["$allModels"] extends object?{[O in keyof T["model"]["$allModels"]]:ReturnType<T["model"]["$allModels"][O]>}:unknown)
}

declare interface ExtendsHookModified<Variant extends 'extends' | 'define', TypeMapCb extends $Extensions.TypeMapCbDef, ExtArgs extends Record<string, any>, TypeMap extends $Extensions.TypeMapDef = $Utils.Call<TypeMapCb, {
Expand Down

0 comments on commit dfb0f51

Please sign in to comment.