pull/715/head
Travis Fischer 2025-06-18 06:35:40 +07:00
rodzic 927ec86116
commit cddc6a19de
2 zmienionych plików z 16 dodań i 5 usunięć

Wyświetl plik

@ -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]
>() >()

Wyświetl plik

@ -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<