Fix idColumn type#2744
Conversation
|
|
||
| tableName: string; | ||
| idColumn: string | string[]; | ||
| idColumn: null | string | string[]; |
There was a problem hiding this comment.
Should probably be last, not first? Also, it was suggested here to use never instead of null? What's more suitable?
There was a problem hiding this comment.
There was a problem hiding this comment.
@geeksilva97 @lehni
null - is not safe from the point of view of logic and types!
if you do not explicitly specify returning (for example returning(*)) then this will implicitly lead to the fact that it will try to use null (since the method will return null) and this will lead to an error at runtime!
see #2693 (comment)
that is, objection will compile an invalid SQL query!
therefore never is necessary - so that at the compilation stage (on the js side) there is an error, and an invalid SQL query does not sent to the database side!
There was a problem hiding this comment.
what does 'returning(*)' mean?
There was a problem hiding this comment.
Should probably be last, not first? Also, it was suggested here to use never instead of null? What's more suitable?
I don't think the order matters. Just let me know if you want me to change it
There was a problem hiding this comment.
what does 'returning(*)' mean?
this is a normal sql expression....
There was a problem hiding this comment.
related threads
#2746 (comment)
#2693 (comment)

Fixes #2693