kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
927ec86116
commit
cddc6a19de
|
@ -1,3 +1,4 @@
|
||||||
|
import type { Simplify } from 'type-fest'
|
||||||
import { expectTypeOf, test } from 'vitest'
|
import { expectTypeOf, test } from 'vitest'
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
|
@ -5,7 +6,9 @@ import type {
|
||||||
LogEntry,
|
LogEntry,
|
||||||
RawConsumer,
|
RawConsumer,
|
||||||
RawConsumerUpdate,
|
RawConsumerUpdate,
|
||||||
|
RawDeployment,
|
||||||
RawLogEntry,
|
RawLogEntry,
|
||||||
|
RawProject,
|
||||||
RawUser,
|
RawUser,
|
||||||
User
|
User
|
||||||
} from './types'
|
} from './types'
|
||||||
|
@ -14,6 +17,14 @@ type UserKeys = Exclude<keyof User & keyof RawUser, 'authProviders'>
|
||||||
type LogEntryKeys = keyof RawLogEntry & keyof LogEntry
|
type LogEntryKeys = keyof RawLogEntry & keyof LogEntry
|
||||||
type ConsumerKeys = keyof RawConsumer & keyof Consumer
|
type ConsumerKeys = keyof RawConsumer & keyof Consumer
|
||||||
|
|
||||||
|
type TODOFixedConsumer = Simplify<
|
||||||
|
Omit<Consumer, 'user' | 'project' | 'deployment'> & {
|
||||||
|
user?: RawUser | null
|
||||||
|
project?: RawProject | null
|
||||||
|
deployment?: RawDeployment | null
|
||||||
|
}
|
||||||
|
>
|
||||||
|
|
||||||
test('User types are compatible', () => {
|
test('User types are compatible', () => {
|
||||||
expectTypeOf<RawUser>().toExtend<User>()
|
expectTypeOf<RawUser>().toExtend<User>()
|
||||||
|
|
||||||
|
@ -29,9 +40,9 @@ test('LogEntry types are compatible', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Consumer types are compatible', () => {
|
test('Consumer types are compatible', () => {
|
||||||
expectTypeOf<RawConsumer>().toExtend<Consumer>()
|
expectTypeOf<RawConsumer>().toExtend<TODOFixedConsumer>()
|
||||||
|
|
||||||
expectTypeOf<Consumer[ConsumerKeys]>().toEqualTypeOf<
|
expectTypeOf<TODOFixedConsumer[ConsumerKeys]>().toEqualTypeOf<
|
||||||
RawConsumer[ConsumerKeys]
|
RawConsumer[ConsumerKeys]
|
||||||
>()
|
>()
|
||||||
|
|
||||||
|
|
|
@ -63,9 +63,9 @@ export type ConsumerWithProjectAndDeployment = BuildQueryResult<
|
||||||
>
|
>
|
||||||
export type RawConsumer = Simplify<
|
export type RawConsumer = Simplify<
|
||||||
InferSelectModel<typeof schema.consumers> & {
|
InferSelectModel<typeof schema.consumers> & {
|
||||||
user?: RawUser | null // TODO: remove null (requires drizzle-orm changes)
|
user?: RawUser | undefined | null // TODO: remove null (requires drizzle-orm changes)
|
||||||
project?: RawProject | null // TODO: remove null (requires drizzle-orm changes)
|
project?: RawProject | undefined | null // TODO: remove null (requires drizzle-orm changes)
|
||||||
deployment?: RawDeployment | null // TODO: remove null (requires drizzle-orm changes)
|
deployment?: RawDeployment | undefined | null // TODO: remove null (requires drizzle-orm changes)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
export type RawConsumerUpdate = Partial<
|
export type RawConsumerUpdate = Partial<
|
||||||
|
|
Ładowanie…
Reference in New Issue