Repository navigation
[No QA] [TS migration] Migrate 'ReportActionsUtils.js' lib to TypeScript #28570
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
Changes from all commits
ed6e2da
d159170
6731db8
8ad122f
1b50456
484eefb
12ed819
2d37dfd
8690c0a
22cfff6
0aec412
258d0a8
e74d724
5906975
a55f1a4
934a95e
60d97bb
fabce75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| import {ValueOf} from 'type-fest'; | ||
| import CONST from '../../CONST'; | ||
| import DeepValueOf from '../utils/DeepValueOf'; | ||
|
|
||
| type ActionName = DeepValueOf<typeof CONST.REPORT.ACTIONS.TYPE>; | ||
|
|
||
| type OriginalMessageApproved = { | ||
| actionName: typeof CONST.REPORT.ACTIONS.TYPE.APPROVED; | ||
| originalMessage: unknown; | ||
| }; | ||
|
|
||
| type IOUDetails = { | ||
| amount: number; | ||
| comment?: string; | ||
| currency: string; | ||
| }; | ||
|
|
||
| type OriginalMessageIOU = { | ||
| actionName: typeof CONST.REPORT.ACTIONS.TYPE.IOU; | ||
|
|
@@ -8,23 +22,38 @@ type OriginalMessageIOU = { | |
| IOUTransactionID?: string; | ||
|
|
||
| IOUReportID?: number; | ||
|
|
||
| /** Only exists when we are sending money */ | ||
| IOUDetails?: IOUDetails; | ||
|
|
||
| amount: number; | ||
| comment?: string; | ||
| currency: string; | ||
| lastModified?: string; | ||
| participantAccountIDs?: number[]; | ||
| type: string; | ||
| type: ValueOf<typeof CONST.IOU.REPORT_ACTION_TYPE>; | ||
| }; | ||
| }; | ||
|
|
||
| type FlagSeverityName = 'spam' | 'inconsiderate' | 'bullying' | 'intimidation' | 'harassment' | 'assault'; | ||
| type FlagSeverityName = ValueOf< | ||
| Pick< | ||
| typeof CONST.MODERATION, | ||
| 'FLAG_SEVERITY_SPAM' | 'FLAG_SEVERITY_INCONSIDERATE' | 'FLAG_SEVERITY_INTIMIDATION' | 'FLAG_SEVERITY_BULLYING' | 'FLAG_SEVERITY_HARASSMENT' | 'FLAG_SEVERITY_ASSAULT' | ||
| > | ||
| >; | ||
| type FlagSeverity = { | ||
| accountID: number; | ||
| timestamp: string; | ||
| }; | ||
|
|
||
| type DecisionName = ValueOf< | ||
| Pick< | ||
| typeof CONST.MODERATION, | ||
| 'MODERATOR_DECISION_PENDING' | 'MODERATOR_DECISION_PENDING_HIDE' | 'MODERATOR_DECISION_PENDING_REMOVE' | 'MODERATOR_DECISION_APPROVED' | 'MODERATOR_DECISION_HIDDEN' | ||
| > | ||
| >; | ||
| type Decision = { | ||
| decision: string; | ||
| decision: DecisionName; | ||
| timestamp: string; | ||
| }; | ||
|
|
||
|
|
@@ -62,7 +91,7 @@ type OriginalMessageClosed = { | |
| actionName: typeof CONST.REPORT.ACTIONS.TYPE.CLOSED; | ||
| originalMessage: { | ||
| policyName: string; | ||
| reason: 'default' | 'accountClosed' | 'accountMerged' | 'removedPolicy' | 'policyDeleted'; | ||
| reason: ValueOf<typeof CONST.REPORT.ARCHIVE_REASON>; | ||
| lastModified?: string; | ||
| }; | ||
| }; | ||
|
|
@@ -128,7 +157,18 @@ type OriginalMessagePolicyTask = { | |
| originalMessage: unknown; | ||
| }; | ||
|
|
||
| type OriginalMessageModifiedExpense = { | ||
| actionName: typeof CONST.REPORT.ACTIONS.TYPE.MODIFIEDEXPENSE; | ||
| originalMessage: unknown; | ||
| }; | ||
|
|
||
| type OriginalMessageReimbursementQueued = { | ||
| actionName: typeof CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTQUEUED; | ||
| originalMessage: unknown; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fabioh8010 Could you comment on this typing? Why is it unknown? Do we really not know the type?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At that time we didn't know the type (same as other types previously declared here), that's why we typed as |
||
| }; | ||
|
|
||
| type OriginalMessage = | ||
| | OriginalMessageApproved | ||
| | OriginalMessageIOU | ||
| | OriginalMessageAddComment | ||
| | OriginalMessageSubmitted | ||
|
|
@@ -138,7 +178,9 @@ type OriginalMessage = | |
| | OriginalMessageChronosOOOList | ||
| | OriginalMessageReportPreview | ||
| | OriginalMessagePolicyChangeLog | ||
| | OriginalMessagePolicyTask; | ||
| | OriginalMessagePolicyTask | ||
| | OriginalMessageModifiedExpense | ||
| | OriginalMessageReimbursementQueued; | ||
|
|
||
| export default OriginalMessage; | ||
| export type {Reaction, ChronosOOOEvent}; | ||
| export type {ChronosOOOEvent, Decision, Reaction, ActionName}; | ||
Uh oh!
There was an error while loading. Please reload this page.