-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add types for query, remove type assertions and switch to inference where possible #26
Conversation
9c7dd76
to
b803496
Compare
@benvinegar These types should work, but the prettier changes make this un-reviewable 😅 will revert them tonight before marking this ready for review. These types can probably be more ergonomic than this, but it's better than |
b803496
to
2d44b9e
Compare
2d44b9e
to
888df60
Compare
@@ -133,14 +133,14 @@ describe("Dashboard route", () => { | |||
countByDevice: [['Desktop', 3]], | |||
viewsGroupedByInterval: [ | |||
['2024-01-11 00:00:00', 4], | |||
['2024-01-26 00:00:00', 0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flakey test, reported in #27
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #26 +/- ##
==========================================
- Coverage 71.68% 71.21% -0.47%
==========================================
Files 18 18
Lines 1695 1831 +136
Branches 110 124 +14
==========================================
+ Hits 1215 1304 +89
- Misses 474 514 +40
- Partials 6 13 +7 ☔ View full report in Codecov by Sentry. |
I spent a solid 30 minutes going over this, mostly because my TypeScript experience is pretty basic, and I had to read up on a bunch of concepts (like user-defined type guards). I think this hardens the API-calling surface a ton, so +1 from me. (Also should probably just put some Prettier rules in here already and add it to the pre-commit stuff.) |
Also – thanks! You've made the first external contribution, which I'm super glad for, because this project isn't going anywhere with just me 😬 |
Invariants are nice, they're basically the same as |
FYI I had to revert this PR in 6c7108 because #30. I didn't do any deep debugging but I agree with the reporters that the Let me know if that's something you wanna poke at – I'm happy to, but I also want to make room for folks. |
First contributor, first to break everything. Casual 😅 . Agreed it's the invariants, though they should be throwing very clear errors. I wonder where those are getting swallowed 🤔 . I see which invariant is broken, it's I was working last night on improving that method to infer the return type based on the name of the column passed in, I'll update that branch to be a bit less aggressive in enforcing type correctness. |
…here possible (#26) Co-authored-by: Cal Irvine <[email protected]>
Connects #13
Sorry about the formatting changes 🤔 I think they're just prettier defaults. I'll try to revert them all to the previous style (unless you want to add a prettier config, then I can just apply that to the branch).
Notes on changes
Hopefully changes aren't controversial, but let me know.