Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.
Merged
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
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export type CheckMatchingArrayTypes<Result, NewResult> =
Result,
NewResult,
{
Error: 'Type mismatch: Cannot cast array result to a single object. Use .returns<Array<YourType>> for array results or .single() to convert the result to a single object'
Error: 'Type mismatch: Cannot cast array result to a single object. Use .overrideTypes<Array<YourType>> or .returns<Array<YourType>> (deprecated) for array results or .single() to convert the result to a single object'
},
{
Error: 'Type mismatch: Cannot cast single object to array type. Remove Array wrapper from return type or make sure you are not using .single() up in the calling chain'
Expand Down
2 changes: 1 addition & 1 deletion test/override-types.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const postgrest = new PostgrestClient<Database>(REST_URL)
TypeEqual<
typeof result,
{
Error: 'Type mismatch: Cannot cast array result to a single object. Use .returns<Array<YourType>> for array results or .single() to convert the result to a single object'
Error: 'Type mismatch: Cannot cast array result to a single object. Use .overrideTypes<Array<YourType>> or .returns<Array<YourType>> (deprecated) for array results or .single() to convert the result to a single object'
}
>
>(true)
Expand Down
2 changes: 1 addition & 1 deletion test/returns.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const postgrest = new PostgrestClient<Database>(REST_URL)
}
let resultType: typeof invalidCastArray.data
let resultExpected: {
Error: 'Type mismatch: Cannot cast array result to a single object. Use .returns<Array<YourType>> for array results or .single() to convert the result to a single object'
Error: 'Type mismatch: Cannot cast array result to a single object. Use .overrideTypes<Array<YourType>> or .returns<Array<YourType>> (deprecated) for array results or .single() to convert the result to a single object'
}
expectType<TypeEqual<typeof resultType, typeof resultExpected>>(true)

Expand Down
Loading