-
Notifications
You must be signed in to change notification settings - Fork 30
Row is possibly undefined #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We can update the generated code with an additional if (result.rows.length !== 1) {
return null;
}
const row = result.rows[0];
if (!row) {
return null;
}
return {
id: row[0],
name: row[1],
bio: row[2]
}; |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not a bug but more of an annoying issue. Upon generating the TypeScript file, there is an issue where
row
might be undefined duringconst row = result.rows[0];
. One simple solution would be to typecast by editing the generated file, but it is not really ideal. Would there be a better solution to this?The text was updated successfully, but these errors were encountered: