Skip to content

Commit

Permalink
Merge pull request #28596 from software-mansion-labs/ts-migration/Sid…
Browse files Browse the repository at this point in the history
…ebarUtils

[TS migration] Migrate 'SidebarUtils.js' lib to TypeScript
  • Loading branch information
bondydaa authored Oct 26, 2023
2 parents 99f4fe6 + 8d42d7f commit 9802795
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 125 deletions.
4 changes: 2 additions & 2 deletions src/libs/PersonalDetailsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Onyx.connect({
});

/**
* @param {Object} passedPersonalDetails
* @param {Array} pathToDisplayName
* @param {Object | Null} passedPersonalDetails
* @param {Array | String} pathToDisplayName
* @param {String} [defaultValue] optional default display name value
* @returns {String}
*/
Expand Down
4 changes: 2 additions & 2 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function isConsecutiveActionMadeByPreviousActor(reportActions: ReportAction[] |
/**
* Checks if a reportAction is deprecated.
*/
function isReportActionDeprecated(reportAction: OnyxEntry<ReportAction>, key: string): boolean {
function isReportActionDeprecated(reportAction: OnyxEntry<ReportAction>, key: string | number): boolean {
if (!reportAction) {
return true;
}
Expand All @@ -289,7 +289,7 @@ const supportedActionTypes: ActionName[] = [...Object.values(otherActionTypes),
* Checks if a reportAction is fit for display, meaning that it's not deprecated, is of a valid
* and supported type, it's not deleted and also not closed.
*/
function shouldReportActionBeVisible(reportAction: OnyxEntry<ReportAction>, key: string): boolean {
function shouldReportActionBeVisible(reportAction: OnyxEntry<ReportAction>, key: string | number): boolean {
if (!reportAction) {
return false;
}
Expand Down
16 changes: 8 additions & 8 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ function getPolicyType(report, policies) {
/**
* Get the policy name from a given report
* @param {Object} report
* @param {String} report.policyID
* @param {String} report.oldPolicyName
* @param {String} report.policyName
* @param {String} [report.policyID]
* @param {String} [report.oldPolicyName]
* @param {String} [report.policyName]
* @param {Boolean} [returnEmptyIfNotFound]
* @param {Object} [policy]
* @returns {String}
Expand Down Expand Up @@ -369,7 +369,7 @@ function isUserCreatedPolicyRoom(report) {
/**
* Whether the provided report is a Policy Expense chat.
* @param {Object} report
* @param {String} report.chatType
* @param {String} [report.chatType]
* @returns {Boolean}
*/
function isPolicyExpenseChat(report) {
Expand All @@ -395,7 +395,7 @@ function isControlPolicyExpenseReport(report) {
/**
* Whether the provided report is a chat room
* @param {Object} report
* @param {String} report.chatType
* @param {String} [report.chatType]
* @returns {Boolean}
*/
function isChatRoom(report) {
Expand Down Expand Up @@ -584,8 +584,8 @@ function findLastAccessedReport(reports, ignoreDomainRooms, policies, isFirstTim
/**
* Whether the provided report is an archived room
* @param {Object} report
* @param {Number} report.stateNum
* @param {Number} report.statusNum
* @param {Number} [report.stateNum]
* @param {Number} [report.statusNum]
* @returns {Boolean}
*/
function isArchivedRoom(report) {
Expand Down Expand Up @@ -3241,7 +3241,7 @@ function shouldHideReport(report, currentReportId) {
* filter out the majority of reports before filtering out very specific minority of reports.
*
* @param {Object} report
* @param {String} currentReportId
* @param {String | Null | Undefined} currentReportId
* @param {Boolean} isInGSDMode
* @param {String[]} betas
* @param {Object} policies
Expand Down
Loading

0 comments on commit 9802795

Please sign in to comment.