Skip to content

Commit e7089f6

Browse files
committed
fix: in filter
1 parent 13a65ec commit e7089f6

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

src/PostgrestFilterBuilder.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ export default class PostgrestFilterBuilder<
7575
column: ColumnName,
7676
value: ResolveFilterValue<Schema, Row, ColumnName> extends infer ResolvedFilterValue
7777
? ResolvedFilterValue extends never
78-
? NonNullable<unknown>
78+
? unknown
7979
: NonNullable<ResolvedFilterValue>
80-
: never
80+
: unknown
8181
): this {
8282
this.url.searchParams.append(column, `eq.${value}`)
8383
return this
@@ -95,7 +95,7 @@ export default class PostgrestFilterBuilder<
9595
? ResolvedFilterValue extends never
9696
? unknown
9797
: NonNullable<ResolvedFilterValue>
98-
: never
98+
: unknown
9999
): this {
100100
this.url.searchParams.append(column, `neq.${value}`)
101101
return this

test/issue-1354-d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,17 @@ const postgrestOverrideTypes = new PostgrestClient<DatabaseOverride>('http://loc
212212
})
213213
.eq('id', res.data.id)
214214
expectType<null>(result.data)
215+
const resIn = await postgrestOverrideTypes
216+
.from('foo')
217+
.select('id, bar, baz')
218+
.in('bar', [
219+
{ version: 1, events: [] },
220+
{ version: 2, events: [] },
221+
])
222+
.single()
223+
224+
if (resIn.error) {
225+
throw new Error(resIn.error.message)
226+
}
227+
expectType<{ id: string; bar: Custom; baz: Custom }>(resIn.data)
215228
}

test/relationships.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,12 @@ test('self reference relation via column', async () => {
18301830
})
18311831

18321832
test('aggregate on missing column with alias', async () => {
1833-
const res = await selectQueries.aggregateOnMissingColumnWithAlias.eq('id', 1).limit(1).single()
1833+
const res = await selectQueries.aggregateOnMissingColumnWithAlias
1834+
// @ts-expect-error should not be able to eq 'id' since the column does not
1835+
// exist
1836+
.eq('id', 2)
1837+
.limit(1)
1838+
.single()
18341839
expect(res).toMatchInlineSnapshot(`
18351840
Object {
18361841
"count": null,

0 commit comments

Comments
 (0)