-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[TS Migration] Migrate PlaidLink directory to TypeScript #30915
Merged
mountiny
merged 11 commits into
Expensify:main
from
JKobrynski:migratePlaidLinkToTypeScript
Nov 28, 2023
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8c008e3
start migrating PlaidLink to TypeScript
JKobrynski 0205ca5
migrate PlaidLinks native module to TypeScript, create a file for types
JKobrynski d7ca940
Merge branch 'main' into migratePlaidLinkToTypeScript
JKobrynski e55fe14
migrate native PlaidLink to TypeScript
JKobrynski 9e15bc8
make onEvent a required prop to avoid optional chaining
JKobrynski a7ddf2c
Merge branch 'main' into migratePlaidLinkToTypeScript
JKobrynski 42d0373
remove unused nativeModule
JKobrynski 3d12dc8
pass event to Log.info
JKobrynski 2eaae67
allow metadata to be undefined in onEvent
JKobrynski b41332c
make publicToken required param
JKobrynski 938887f
change eventName type to string
JKobrynski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JKobrynski marked this conversation as resolved.
Show resolved
Hide resolved
|
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,25 @@ | ||||||
import {LinkEventMetadata, LinkSuccessMetadata} from 'react-native-plaid-link-sdk'; | ||||||
import {PlaidLinkOnEventMetadata, PlaidLinkOnSuccessMetadata, PlaidLinkStableEvent} from 'react-plaid-link'; | ||||||
|
||||||
type PlaidLinkProps = { | ||||||
// Plaid Link SDK public token used to initialize the Plaid SDK | ||||||
token: string; | ||||||
|
||||||
// Callback to execute once the user taps continue after successfully entering their account information | ||||||
onSuccess?: (args: {publicToken?: string; metadata: PlaidLinkOnSuccessMetadata | LinkSuccessMetadata}) => void; | ||||||
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.
Suggested change
publicToken is not optional 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. Done! |
||||||
|
||||||
// Callback to execute when there is an error event emitted by the Plaid SDK | ||||||
onError?: (error: ErrorEvent | null) => void; | ||||||
|
||||||
// Callback to execute when the user leaves the Plaid widget flow without entering any information | ||||||
onExit?: () => void; | ||||||
|
||||||
// Callback to execute whenever a Plaid event occurs | ||||||
onEvent?: (eventName: PlaidLinkStableEvent | string, metadata?: PlaidLinkOnEventMetadata | LinkEventMetadata) => void; | ||||||
|
||||||
// The redirect URI with an OAuth state ID. Needed to re-initialize the PlaidLink after directing the | ||||||
// user to their respective bank platform | ||||||
receivedRedirectURI?: string; | ||||||
}; | ||||||
|
||||||
export default PlaidLinkProps; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are you sure there should be
event.eventName
here?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.
If you try to pass the whole
event
object, it produces the following error:Do you think we should keep it as it is or maybe
JSON.stringify
it?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.
Related to microsoft/TypeScript#15300. There is no correct way to fix. We can however apply a workaround:
{...event}
toLog.info
event: Pick<LinkEvent, keyof LinkEvent>
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.
Done (1st option)