Skip to content

Commit 8ba8745

Browse files
fix(types): outdated error message (#608)
* fix: outdated error message * chore: update tests --------- Co-authored-by: Bobbie Soedirgo <[email protected]>
1 parent 1f93ee5 commit 8ba8745

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export type CheckMatchingArrayTypes<Result, NewResult> =
114114
Result,
115115
NewResult,
116116
{
117-
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'
117+
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'
118118
},
119119
{
120120
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'

test/override-types.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const postgrest = new PostgrestClient<Database>(REST_URL)
2020
TypeEqual<
2121
typeof result,
2222
{
23-
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'
23+
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'
2424
}
2525
>
2626
>(true)

test/returns.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const postgrest = new PostgrestClient<Database>(REST_URL)
4141
}
4242
let resultType: typeof invalidCastArray.data
4343
let resultExpected: {
44-
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'
44+
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'
4545
}
4646
expectType<TypeEqual<typeof resultType, typeof resultExpected>>(true)
4747

0 commit comments

Comments
 (0)