Replies: 1 comment
-
+1 to this. Was surprised this wasn't supported. I ran into this because I made a typo and had to debug why. It's also confusing on when to use camelCase or snake_case. Seems like bother are supported but it should probable be snake_case to match the DB? Or camel to match the model? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm currently playing around with AdonisJS (5) and really liking it so far. One thing that is bugging me though is that some methods on the LucidModel interface are not typed very strictly.
For example the type of the findBy method is
This does not give me any type safety when checking for certain keys, also the value is typed as any which lets me input anything there. I was wondering if there was any reason why these methods are typed this way and not something like this:
Which is stricter and gives me less chance to wrongly type columns names and their values.
Also is there a way I can force these kinds of types in my own codebase? I tried adding it to a types.d.ts file (in my own codebase) but there were no restrictions imposed by the type nor any type hinting on key names. It did find the type I defined as an additional overload.
The d.ts file:
Beta Was this translation helpful? Give feedback.
All reactions