Skip to content
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

Implement ViolationUtils lib #31083 #73

Merged

Conversation

trevor-coleman
Copy link

This implements the ViolationUtils lib as requested in Expensify#31083

Some notes on approach:

  1. He asked for those violationFields and formFields objects, I think as a sort of hack to get some type checking and type safety. I replaced that with string literal union types and Records -- it's a more idiomatic way to do what he was trying to do, and I think will be better long-term. I asked for his feedback on the approach here. I don't think he's a JS / TS dev so hopefully he finds this helpful, but if he doesn't like it, it'll be pretty easy to switch it back.

  2. I had to add some stuff to ONYXKEYS and to onyx/types -- please take a look and let me know if anything seems like it's in completely the wrong place.

Otherwise should be pretty straightforward!

This is a draft pending his approval of the approach, but would appreciate reviews so I can ship it as soon as he gives me the go-ahead.

@trevor-coleman trevor-coleman changed the base branch from main to violation-utils November 20, 2023 18:49
@trevor-coleman
Copy link
Author

Re-pointed this to violations-utils.

Copy link
Member

@cdanwards cdanwards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! It's not their usual pattern to include the methods in a module but with the way they use them, this makes more sense. They also might want JSDoc for the params on the functions. I say might because I haven't encountered their expectations for ts files yet.

@trevor-coleman trevor-coleman marked this pull request as ready for review November 20, 2023 22:29
@trevor-coleman trevor-coleman merged commit 6a67fb8 into violation-utils Nov 21, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants