-
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
[TS migration] Migrate 'getPermittedDecimalSeparator' lib to TypeScript #30160
Merged
AndrewGable
merged 5 commits into
Expensify:main
from
software-mansion-labs:ts-migration/get-permitted-decimal-separator
Nov 7, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
433a54b
Rename getPermittedDecimalSeparator
BartoszGrajdek 1760004
[TS migration] Migrate 'getPermittedDecimalSeparator' lib to TypeScript
BartoszGrajdek 5d8dfec
QFix
BartoszGrajdek cf37fbf
Resolve merge conflicts
BartoszGrajdek 3640c82
Prettier fix
BartoszGrajdek 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 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,7 @@ | ||
// On iOS keyboard can only have one symbol at a time (either dot or comma) so we accept both | ||
// Details: https://expensify.slack.com/archives/C01GTK53T8Q/p1658936908481629 | ||
import GetPermittedDecimalSeparator from './types'; | ||
|
||
const getPermittedDecimalSeparator: GetPermittedDecimalSeparator = () => '.,'; | ||
|
||
export default getPermittedDecimalSeparator; |
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,14 @@ | ||
import getOperatingSystem from '@libs/getOperatingSystem'; | ||
import CONST from '@src/CONST'; | ||
import getPermittedDecimalSeparatorIOS from './index.ios'; | ||
import GetPermittedDecimalSeparator from './types'; | ||
|
||
const getPermittedDecimalSeparator: GetPermittedDecimalSeparator = (localizedSeparator) => { | ||
if (getOperatingSystem() === CONST.OS.IOS) { | ||
return getPermittedDecimalSeparatorIOS(localizedSeparator); | ||
} | ||
|
||
return localizedSeparator; | ||
}; | ||
|
||
export default getPermittedDecimalSeparator; |
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,3 @@ | ||||||
type GetPermittedDecimalSeparator = (localizedSeparator: string) => string; | ||||||
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
Should be optional |
||||||
|
||||||
export default GetPermittedDecimalSeparator; |
Oops, something went wrong.
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.
@BartoszGrajdek Is there a reason to be passing
localizedSeparator
here now? I think is not necessary as it is importinggetPermittedDecimalSeparatorIOS
from'./index.ios'
and this param is not used there, so we should keep the previous behaviorThere 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.
I didn't want to change the functionality of these functions, keeping them consistent in types whether it's ios or other plaforms. That's why I've added it as a mandatory parameter, even though it's not being used on ios. If I have changed it to
localizedSeparator?: string
I would need to provide a default value togetPermittedDecimalSeparator
because I don't want to return anything else other than stringThere 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.
I agree with @BartoszGrajdek, the param isn't used in one implementation, but from the usage it does make sense to make it required. Wdyt @fabioh8010?
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.
@BartoszGrajdek Thanks for explanation, makes sense to me!