From cfb98fc9b9b9f47874c6db650108f94b405cc3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Nawojczyk?= <102222064+rafalnawojczyk@users.noreply.github.com> Date: Sat, 8 Mar 2025 14:24:42 +0100 Subject: [PATCH 1/2] fix: outdated error message --- src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types.ts b/src/types.ts index 569866bb..51d58a70 100644 --- a/src/types.ts +++ b/src/types.ts @@ -114,7 +114,7 @@ export type CheckMatchingArrayTypes = Result, NewResult, { - Error: 'Type mismatch: Cannot cast array result to a single object. Use .returns> 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> or .returns> (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' From 6a3cf6e5290788632137fbd61d2c68c5df4142ca Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo Date: Thu, 13 Mar 2025 11:39:00 +0100 Subject: [PATCH 2/2] chore: update tests --- test/override-types.test-d.ts | 2 +- test/returns.test-d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/override-types.test-d.ts b/test/override-types.test-d.ts index 56164389..41be1c19 100644 --- a/test/override-types.test-d.ts +++ b/test/override-types.test-d.ts @@ -20,7 +20,7 @@ const postgrest = new PostgrestClient(REST_URL) TypeEqual< typeof result, { - Error: 'Type mismatch: Cannot cast array result to a single object. Use .returns> 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> or .returns> (deprecated) for array results or .single() to convert the result to a single object' } > >(true) diff --git a/test/returns.test-d.ts b/test/returns.test-d.ts index 551a0e22..040d3569 100644 --- a/test/returns.test-d.ts +++ b/test/returns.test-d.ts @@ -41,7 +41,7 @@ const postgrest = new PostgrestClient(REST_URL) } let resultType: typeof invalidCastArray.data let resultExpected: { - Error: 'Type mismatch: Cannot cast array result to a single object. Use .returns> 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> or .returns> (deprecated) for array results or .single() to convert the result to a single object' } expectType>(true)