Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/types/create.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ it('infers initial values from primitives in the schema', async () => {
new Collection({ schema: z.object({ id: z.number().optional() }) }).create,
)
.parameter(0)
.toEqualTypeOf<{ id?: number | undefined }>()
.toEqualTypeOf<{ id?: number }>()

expectTypeOf(new Collection({ schema: z.object({ id: z.string() }) }).create)
.parameter(0)
Expand All @@ -20,7 +20,7 @@ it('infers initial values from primitives in the schema', async () => {
new Collection({ schema: z.object({ id: z.string().optional() }) }).create,
)
.parameter(0)
.toEqualTypeOf<{ id?: string | undefined }>()
.toEqualTypeOf<{ id?: string }>()
})

it('infers initial values from a nested schema', async () => {
Expand All @@ -40,7 +40,7 @@ it('infers initial values from a nested schema', async () => {
}).create,
)
.parameter(0)
.toEqualTypeOf<{ address: { street?: string | undefined } }>()
.toEqualTypeOf<{ address: { street?: string } }>()

expectTypeOf(
new Collection({
Expand All @@ -50,7 +50,7 @@ it('infers initial values from a nested schema', async () => {
}).create,
)
.parameter(0)
.toEqualTypeOf<{ address?: { street: string } | undefined }>()
.toEqualTypeOf<{ address?: { street: string } }>()
})

it('infers the record type (return type) from the schema', async () => {
Expand All @@ -60,15 +60,15 @@ it('infers the record type (return type) from the schema', async () => {

expectTypeOf(
new Collection({ schema: z.object({ id: z.number().optional() }) }).create,
).returns.resolves.toEqualTypeOf<RecordType<{ id?: number | undefined }>>()
).returns.resolves.toEqualTypeOf<RecordType<{ id?: number }>>()

expectTypeOf(
new Collection({ schema: z.object({ id: z.string() }) }).create,
).returns.resolves.toEqualTypeOf<RecordType<{ id: string }>>()

expectTypeOf(
new Collection({ schema: z.object({ id: z.string().optional() }) }).create,
).returns.resolves.toEqualTypeOf<RecordType<{ id?: string | undefined }>>()
).returns.resolves.toEqualTypeOf<RecordType<{ id?: string }>>()

expectTypeOf(
new Collection({
Expand All @@ -85,7 +85,7 @@ it('infers the record type (return type) from the schema', async () => {
}),
}).create,
).returns.resolves.toEqualTypeOf<
RecordType<{ address: { street?: string | undefined } }>
RecordType<{ address: { street?: string } }>
>()

expectTypeOf(
Expand All @@ -95,6 +95,6 @@ it('infers the record type (return type) from the schema', async () => {
}),
}).create,
).returns.resolves.toEqualTypeOf<
RecordType<{ address?: { street: string } | undefined }>
RecordType<{ address?: { street: string } }>
>()
})
6 changes: 3 additions & 3 deletions tests/types/find-many.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ it('supports sorting the results', () => {
.toHaveProperty('orderBy')
.toEqualTypeOf<
| {
id?: SortDirection | undefined
name?: SortDirection | undefined
nested?: { key?: SortDirection | undefined }
id?: SortDirection
name?: SortDirection
nested?: { key?: SortDirection }
}
| undefined
>()
Expand Down