circularity test is fixed

This commit is contained in:
Dan Vanderkam 2024-02-23 10:52:40 -05:00
parent ef2d465047
commit 933605267c
No known key found for this signature in database
2 changed files with 11 additions and 42 deletions

View File

@ -1,31 +0,0 @@
circularConstructorWithReturn.ts(3,13): error TS2456: Type alias 'Client' circularly references itself.
circularConstructorWithReturn.ts(7,5): error TS2502: 'self' is referenced directly or indirectly in its own type annotation.
circularConstructorWithReturn.ts(16,48): error TS2502: 'client' is referenced directly or indirectly in its own type annotation.
==== circularConstructorWithReturn.ts (3 errors) ====
// This should not be a circularity error. See
// https://github.com/microsoft/TypeScript/pull/57465#issuecomment-1960271216
export type Client = ReturnType<typeof getPrismaClient> extends new () => infer T ? T : never
~~~~~~
!!! error TS2456: Type alias 'Client' circularly references itself.
export function getPrismaClient(options?: any) {
class PrismaClient {
self: Client;
~~~~
!!! error TS2502: 'self' is referenced directly or indirectly in its own type annotation.
constructor(options?: any) {
return (this.self = applyModelsAndClientExtensions(this));
}
}
return PrismaClient
}
export function applyModelsAndClientExtensions(client: Client) {
~~~~~~~~~~~~~~
!!! error TS2502: 'client' is referenced directly or indirectly in its own type annotation.
return client;
}

View File

@ -4,7 +4,7 @@
// This should not be a circularity error. See
// https://github.com/microsoft/TypeScript/pull/57465#issuecomment-1960271216
export type Client = ReturnType<typeof getPrismaClient> extends new () => infer T ? T : never
>Client : any
>Client : PrismaClient
>getPrismaClient : (options?: any) => typeof PrismaClient
export function getPrismaClient(options?: any) {
@ -15,19 +15,19 @@ export function getPrismaClient(options?: any) {
>PrismaClient : PrismaClient
self: Client;
>self : any
>self : PrismaClient
constructor(options?: any) {
>options : any
return (this.self = applyModelsAndClientExtensions(this));
>(this.self = applyModelsAndClientExtensions(this)) : any
>this.self = applyModelsAndClientExtensions(this) : any
>this.self : any
>(this.self = applyModelsAndClientExtensions(this)) : PrismaClient
>this.self = applyModelsAndClientExtensions(this) : PrismaClient
>this.self : PrismaClient
>this : this
>self : any
>applyModelsAndClientExtensions(this) : any
>applyModelsAndClientExtensions : (client: any) => any
>self : PrismaClient
>applyModelsAndClientExtensions(this) : PrismaClient
>applyModelsAndClientExtensions : (client: PrismaClient) => PrismaClient
>this : this
}
}
@ -37,10 +37,10 @@ export function getPrismaClient(options?: any) {
}
export function applyModelsAndClientExtensions(client: Client) {
>applyModelsAndClientExtensions : (client: any) => any
>client : any
>applyModelsAndClientExtensions : (client: Client) => PrismaClient
>client : PrismaClient
return client;
>client : any
>client : PrismaClient
}