You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently have table public_user_info with a nullable display_name column; I recently decided to make display_name non-nullable.
The SQL to alter the table:
alter table public.public_user_info
alter column display_name set default '',
alter column display_name set not null;
So I want to update my client-side public_user_info2 interface structure to reflect that column is now mandatory.
But when I do that, the Typescript compiler gives me the error:
TypeScript error in C:/projects/cabbage/app/src/Api/CabbageApi.ts(26,18):
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'. TS2345
24 | await db.from<public_user_info2>('public_user_info').
25 | select('display_name').
> 26 | eq("uuid", db.auth.user()?.id);
| ^
27 |
28 | return queryResult;
29 | }
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I currently have table
public_user_info
with a nullabledisplay_name
column; I recently decided to makedisplay_name
non-nullable.The SQL to alter the table:
So I want to update my client-side
public_user_info2
interface structure to reflect that column is now mandatory.But when I do that, the Typescript compiler gives me the error:
The code looks like this:
The error is caused when I try to change
display_name?: string
to be declareddisplay_name: string
.What am I doing wrong?
The code for this project ( so package.json, etc.) is available on Github.
I am using "@supabase/supabase-js": "1.3.4"
Beta Was this translation helpful? Give feedback.
All reactions