-
Notifications
You must be signed in to change notification settings - Fork 842
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
Convert services to TypeScript, part 1 #1360
Convert services to TypeScript, part 1 #1360
Conversation
I've added the tests that I intended, so this is no longer WIP. |
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.
Couple small things & questions. Looks fantastic though.
e75411f
to
7487b66
Compare
@chandlerprall I've addressed your feedback and rebased on |
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.
LGreatTM !
7487b66
to
20b436f
Compare
Summary
This PR converts roughly half the services to TypeScript. Implementation notes:
browser.ts
, I tried to make it clear what contractBrowser
was fulfilling, and I may have ended up with something more verbose that necessary.color_palette.ts
had its own hex -> RGB convertor, so I replaced it withhexToRgb
. I also removedformatHex()
since it was redundant.rgb_to_hex.ts
, I replaced the single ugly regex with two passes to simplify the implementation. I could still do it in one, and maybe it would be more legible than before? Opinions welcome. I also made it stricter, since the original didn't check the whole argument value i.e, you could passrgb(1,2,3
and it would return a hex code.random.ts
, I ran up against Wrong 'this' context in class methods microsoft/TypeScript#3927 and had to make all the method definitions bound.Checklist