-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[No QA][TS migration] Migrate 'UserUtils.js' lib to TypeScript #27778
[No QA][TS migration] Migrate 'UserUtils.js' lib to TypeScript #27778
Conversation
@allroundexperts Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
We did not find an internal engineer to review this PR, trying to assign a random engineer to #24882 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
function hasLoginListError(loginList) { | ||
return _.some(loginList, (login) => _.some(lodashGet(login, 'errorFields', {}), (field) => !_.isEmpty(field))); | ||
function hasLoginListError(loginList: LoginList): boolean { | ||
const errorFields = loginList?.errorFields ?? {}; |
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.
Is the type loginList: LoginList
correct? if it is, we wouldn't need the question mark in loginList?
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.
Yes it's correct, the thing is that this function is still used in some JS files and wrong values are passed and tests were failing. Once we get to these files that use this function the underlying issue will be fixed.
Either way, it's okay to make code safe and use nullish coalescing
and optional chaining
even if types says it's not necessary.
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.
Either way, it's okay to make code safe and use nullish coalescing and optional chaining even if types says it's not necessary.
I disagree with this, I expect to be able to trust our types, but I understand that this may be acceptable while in a transitional period
I'm not sure why we didn't prefer loginList: Login | undefined | null
if we had cases where we are passing undefined
or null
🤷
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.
Some types don't seem to be correct
@aldo-expensify Let's wait for Callstack review on this PR before merging. |
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.
@blazejkustra LGTM, but we have a type error reported by typecheck
.
@blazejkustra We have another lint error 😅 |
Tests are failing due to this thread. |
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.
LGTM, CK still need to do the checklist.
Reviewer Checklist
Screenshots/VideosWebweb.mp4Mobile Web - Chromemobile-chrome.mp4Mobile Web - Safarimobile-safari.mp4Desktopdesktop.mp4iOSios.mp4Androidandroid.mp4 |
@aldo-expensify PR is all yours now! |
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.
Approving and merging because I think this is mostly correct, if we want to do something regarding this we can do it in a follow up!
Thanks for the work!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/aldo-expensify in version: 1.3.76-0 🚀
|
function hasLoginListInfo(loginList) { | ||
return _.some(loginList, (login) => _.isEmpty(login.validatedDate)); | ||
function hasLoginListInfo(loginList: Login): boolean { | ||
return !loginList.validatedDate; | ||
} |
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.
This change caused this regression: #28643
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.76-6 🚀
|
🚀 Deployed to staging by https://github.com/aldo-expensify in version: 1.3.77-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.77-7 🚀
|
Details
Migration of 'UserUtils.js' to Typescript.
Fixed Issues
$ #24882
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
web.mov
Mobile Web - Chrome
a-web.mov
Mobile Web - Safari
i-web.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov