Skip to content

Commit

Permalink
fix typescript 4.8 issues
Browse files Browse the repository at this point in the history
(cherry picked from commit 60ab5d3)
  • Loading branch information
millsp committed Sep 1, 2022
1 parent adb9516 commit b5aefaa
Show file tree
Hide file tree
Showing 26 changed files with 668 additions and 634 deletions.
7 changes: 7 additions & 0 deletions helpers/blaze/get.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { U } from 'ts-toolbelt'

function get<O extends object, K extends keyof OM, OM = U.Merge<O>>(object: O, key: K): OM[K] {
return object[key as any]
}

export { get }
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"ts-node": "10.9.1",
"ts-toolbelt": "9.6.0",
"tty-browserify": "0.0.1",
"typescript": "4.7.4",
"typescript": "4.8.2",
"util": "0.12.4"
},
"pnpm": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"strip-ansi": "6.0.1",
"tempy": "1.0.1",
"ts-pattern": "4.0.5",
"typescript": "4.7.4"
"typescript": "4.8.2"
},
"scripts": {
"dev": "DEV=true node -r esbuild-register helpers/build.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"ts-jest": "28.0.8",
"ts-node": "10.9.1",
"tsd": "0.21.0",
"typescript": "4.7.4",
"typescript": "4.8.2",
"yeoman-generator": "5.7.0",
"yo": "4.3.0"
},
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ export type ABeautifulEnum = (typeof ABeautifulEnum)[keyof typeof ABeautifulEnum
export class PrismaClient<
T extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
U = 'log' extends keyof T ? T['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<T['log']> : never : never,
GlobalReject = 'rejectOnNotFound' extends keyof T
GlobalReject extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined = 'rejectOnNotFound' extends keyof T
? T['rejectOnNotFound']
: false
> {
Expand Down Expand Up @@ -1122,7 +1122,7 @@ export namespace Prisma {
? False
: T extends Date
? False
: T extends Buffer
: T extends Uint8Array
? False
: T extends BigInt
? False
Expand Down Expand Up @@ -1941,12 +1941,12 @@ export namespace Prisma {
?'include' extends U
? Post & {
[P in TrueKeys<S['include']>]:
P extends 'author' ? UserGetPayload<S['include'][P]> : never
P extends 'author' ? UserGetPayload<Exclude<S['include'], undefined | null>[P]> : never
}
: 'select' extends U
? {
[P in TrueKeys<S['select']>]:
P extends 'author' ? UserGetPayload<S['select'][P]> : P extends keyof Post ? Post[P] : never
P extends 'author' ? UserGetPayload<Exclude<S['select'], undefined | null>[P]> : P extends keyof Post ? Post[P] : never
}
: Post
: Post
Expand All @@ -1958,7 +1958,7 @@ export namespace Prisma {
}
>

export interface PostDelegate<GlobalRejectSettings> {
export interface PostDelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one Post that matches the filter.
* @param {PostFindUniqueArgs} args - Arguments to find a Post
Expand Down Expand Up @@ -2982,14 +2982,14 @@ export namespace Prisma {
?'include' extends U
? User & {
[P in TrueKeys<S['include']>]:
P extends 'posts' ? Array < PostGetPayload<S['include'][P]>> :
P extends '_count' ? UserCountOutputTypeGetPayload<S['include'][P]> : never
P extends 'posts' ? Array < PostGetPayload<Exclude<S['include'], undefined | null>[P]>> :
P extends '_count' ? UserCountOutputTypeGetPayload<Exclude<S['include'], undefined | null>[P]> : never
}
: 'select' extends U
? {
[P in TrueKeys<S['select']>]:
P extends 'posts' ? Array < PostGetPayload<S['select'][P]>> :
P extends '_count' ? UserCountOutputTypeGetPayload<S['select'][P]> : P extends keyof User ? User[P] : never
P extends 'posts' ? Array < PostGetPayload<Exclude<S['select'], undefined | null>[P]>> :
P extends '_count' ? UserCountOutputTypeGetPayload<Exclude<S['select'], undefined | null>[P]> : P extends keyof User ? User[P] : never
}
: User
: User
Expand All @@ -3001,7 +3001,7 @@ export namespace Prisma {
}
>

export interface UserDelegate<GlobalRejectSettings> {
export interface UserDelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one User that matches the filter.
* @param {UserFindUniqueArgs} args - Arguments to find a User
Expand Down Expand Up @@ -4017,14 +4017,14 @@ export namespace Prisma {
?'include' extends U
? M & {
[P in TrueKeys<S['include']>]:
P extends 'n' ? Array < NGetPayload<S['include'][P]>> :
P extends '_count' ? MCountOutputTypeGetPayload<S['include'][P]> : never
P extends 'n' ? Array < NGetPayload<Exclude<S['include'], undefined | null>[P]>> :
P extends '_count' ? MCountOutputTypeGetPayload<Exclude<S['include'], undefined | null>[P]> : never
}
: 'select' extends U
? {
[P in TrueKeys<S['select']>]:
P extends 'n' ? Array < NGetPayload<S['select'][P]>> :
P extends '_count' ? MCountOutputTypeGetPayload<S['select'][P]> : P extends keyof M ? M[P] : never
P extends 'n' ? Array < NGetPayload<Exclude<S['select'], undefined | null>[P]>> :
P extends '_count' ? MCountOutputTypeGetPayload<Exclude<S['select'], undefined | null>[P]> : P extends keyof M ? M[P] : never
}
: M
: M
Expand All @@ -4036,7 +4036,7 @@ export namespace Prisma {
}
>

export interface MDelegate<GlobalRejectSettings> {
export interface MDelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one M that matches the filter.
* @param {MFindUniqueArgs} args - Arguments to find a M
Expand Down Expand Up @@ -5052,14 +5052,14 @@ export namespace Prisma {
?'include' extends U
? N & {
[P in TrueKeys<S['include']>]:
P extends 'm' ? Array < MGetPayload<S['include'][P]>> :
P extends '_count' ? NCountOutputTypeGetPayload<S['include'][P]> : never
P extends 'm' ? Array < MGetPayload<Exclude<S['include'], undefined | null>[P]>> :
P extends '_count' ? NCountOutputTypeGetPayload<Exclude<S['include'], undefined | null>[P]> : never
}
: 'select' extends U
? {
[P in TrueKeys<S['select']>]:
P extends 'm' ? Array < MGetPayload<S['select'][P]>> :
P extends '_count' ? NCountOutputTypeGetPayload<S['select'][P]> : P extends keyof N ? N[P] : never
P extends 'm' ? Array < MGetPayload<Exclude<S['select'], undefined | null>[P]>> :
P extends '_count' ? NCountOutputTypeGetPayload<Exclude<S['select'], undefined | null>[P]> : P extends keyof N ? N[P] : never
}
: N
: N
Expand All @@ -5071,7 +5071,7 @@ export namespace Prisma {
}
>

export interface NDelegate<GlobalRejectSettings> {
export interface NDelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one N that matches the filter.
* @param {NFindUniqueArgs} args - Arguments to find a N
Expand Down Expand Up @@ -6087,14 +6087,14 @@ export namespace Prisma {
?'include' extends U
? OneOptional & {
[P in TrueKeys<S['include']>]:
P extends 'many' ? Array < ManyRequiredGetPayload<S['include'][P]>> :
P extends '_count' ? OneOptionalCountOutputTypeGetPayload<S['include'][P]> : never
P extends 'many' ? Array < ManyRequiredGetPayload<Exclude<S['include'], undefined | null>[P]>> :
P extends '_count' ? OneOptionalCountOutputTypeGetPayload<Exclude<S['include'], undefined | null>[P]> : never
}
: 'select' extends U
? {
[P in TrueKeys<S['select']>]:
P extends 'many' ? Array < ManyRequiredGetPayload<S['select'][P]>> :
P extends '_count' ? OneOptionalCountOutputTypeGetPayload<S['select'][P]> : P extends keyof OneOptional ? OneOptional[P] : never
P extends 'many' ? Array < ManyRequiredGetPayload<Exclude<S['select'], undefined | null>[P]>> :
P extends '_count' ? OneOptionalCountOutputTypeGetPayload<Exclude<S['select'], undefined | null>[P]> : P extends keyof OneOptional ? OneOptional[P] : never
}
: OneOptional
: OneOptional
Expand All @@ -6106,7 +6106,7 @@ export namespace Prisma {
}
>

export interface OneOptionalDelegate<GlobalRejectSettings> {
export interface OneOptionalDelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one OneOptional that matches the filter.
* @param {OneOptionalFindUniqueArgs} args - Arguments to find a OneOptional
Expand Down Expand Up @@ -7132,12 +7132,12 @@ export namespace Prisma {
?'include' extends U
? ManyRequired & {
[P in TrueKeys<S['include']>]:
P extends 'one' ? OneOptionalGetPayload<S['include'][P]> | null : never
P extends 'one' ? OneOptionalGetPayload<Exclude<S['include'], undefined | null>[P]> | null : never
}
: 'select' extends U
? {
[P in TrueKeys<S['select']>]:
P extends 'one' ? OneOptionalGetPayload<S['select'][P]> | null : P extends keyof ManyRequired ? ManyRequired[P] : never
P extends 'one' ? OneOptionalGetPayload<Exclude<S['select'], undefined | null>[P]> | null : P extends keyof ManyRequired ? ManyRequired[P] : never
}
: ManyRequired
: ManyRequired
Expand All @@ -7149,7 +7149,7 @@ export namespace Prisma {
}
>

export interface ManyRequiredDelegate<GlobalRejectSettings> {
export interface ManyRequiredDelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one ManyRequired that matches the filter.
* @param {ManyRequiredFindUniqueArgs} args - Arguments to find a ManyRequired
Expand Down Expand Up @@ -8175,12 +8175,12 @@ export namespace Prisma {
?'include' extends U
? OptionalSide1 & {
[P in TrueKeys<S['include']>]:
P extends 'opti' ? OptionalSide2GetPayload<S['include'][P]> | null : never
P extends 'opti' ? OptionalSide2GetPayload<Exclude<S['include'], undefined | null>[P]> | null : never
}
: 'select' extends U
? {
[P in TrueKeys<S['select']>]:
P extends 'opti' ? OptionalSide2GetPayload<S['select'][P]> | null : P extends keyof OptionalSide1 ? OptionalSide1[P] : never
P extends 'opti' ? OptionalSide2GetPayload<Exclude<S['select'], undefined | null>[P]> | null : P extends keyof OptionalSide1 ? OptionalSide1[P] : never
}
: OptionalSide1
: OptionalSide1
Expand All @@ -8192,7 +8192,7 @@ export namespace Prisma {
}
>

export interface OptionalSide1Delegate<GlobalRejectSettings> {
export interface OptionalSide1Delegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one OptionalSide1 that matches the filter.
* @param {OptionalSide1FindUniqueArgs} args - Arguments to find a OptionalSide1
Expand Down Expand Up @@ -9206,12 +9206,12 @@ export namespace Prisma {
?'include' extends U
? OptionalSide2 & {
[P in TrueKeys<S['include']>]:
P extends 'opti' ? OptionalSide1GetPayload<S['include'][P]> | null : never
P extends 'opti' ? OptionalSide1GetPayload<Exclude<S['include'], undefined | null>[P]> | null : never
}
: 'select' extends U
? {
[P in TrueKeys<S['select']>]:
P extends 'opti' ? OptionalSide1GetPayload<S['select'][P]> | null : P extends keyof OptionalSide2 ? OptionalSide2[P] : never
P extends 'opti' ? OptionalSide1GetPayload<Exclude<S['select'], undefined | null>[P]> | null : P extends keyof OptionalSide2 ? OptionalSide2[P] : never
}
: OptionalSide2
: OptionalSide2
Expand All @@ -9223,7 +9223,7 @@ export namespace Prisma {
}
>

export interface OptionalSide2Delegate<GlobalRejectSettings> {
export interface OptionalSide2Delegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one OptionalSide2 that matches the filter.
* @param {OptionalSide2FindUniqueArgs} args - Arguments to find a OptionalSide2
Expand Down Expand Up @@ -10226,7 +10226,7 @@ export namespace Prisma {
}
>

export interface ADelegate<GlobalRejectSettings> {
export interface ADelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one A that matches the filter.
* @param {AFindUniqueArgs} args - Arguments to find a A
Expand Down Expand Up @@ -11148,7 +11148,7 @@ export namespace Prisma {
}
>

export interface BDelegate<GlobalRejectSettings> {
export interface BDelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one B that matches the filter.
* @param {BFindUniqueArgs} args - Arguments to find a B
Expand Down Expand Up @@ -12040,7 +12040,7 @@ export namespace Prisma {
}
>

export interface CDelegate<GlobalRejectSettings> {
export interface CDelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one C that matches the filter.
* @param {CFindUniqueArgs} args - Arguments to find a C
Expand Down Expand Up @@ -12954,7 +12954,7 @@ export namespace Prisma {
}
>

export interface DDelegate<GlobalRejectSettings> {
export interface DDelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one D that matches the filter.
* @param {DFindUniqueArgs} args - Arguments to find a D
Expand Down Expand Up @@ -13822,7 +13822,7 @@ export namespace Prisma {
}
>

export interface EDelegate<GlobalRejectSettings> {
export interface EDelegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
/**
* Find zero or one E that matches the filter.
* @param {EFindUniqueArgs} args - Arguments to find a E
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/generation/TSClient/Count.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ${indent(
)}
}
${new PayloadType(outputType, false).toTS()}
${new PayloadType(outputType, this.dmmf, false).toTS()}
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/generation/TSClient/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ ${indent(
)}
}
${includeType}
${new PayloadType(this.outputType, !this.dmmf.typeMap[model.name]).toTS()}
${new PayloadType(this.outputType, this.dmmf).toTS()}
${new ModelDelegate(this.outputType, this.dmmf, this.generator).toTS()}
Expand Down Expand Up @@ -397,7 +397,7 @@ ${
`
: ''
}
export interface ${name}Delegate<GlobalRejectSettings> {
export interface ${name}Delegate<GlobalRejectSettings extends Prisma.RejectOnNotFound | Prisma.RejectPerOperation | false | undefined> {
${indent(
nonAggregateActions
.map(
Expand Down

0 comments on commit b5aefaa

Please sign in to comment.