-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor multiple old files to TypeScript #1010
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
84f6944
refactor: rename files to TypeScript
acezard bcbd784
refactor: remove imports as ".js" files
acezard 6427b0d
refactor: add typings to most of the functions
acezard e7f55ed
refactor: rename more files to TS
acezard efd9f8c
refactor: rename ts files to tsx where needed
acezard 5aca8e0
refactor: implement typings to old files
acezard 555da4f
refactor: Implement TS refactor PR comments
acezard 10e0a4e
fix: temporarily fix ci issues
acezard 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
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,31 @@ | ||
import BackgroundGeolocation from 'react-native-background-geolocation' | ||
|
||
import Minilog from 'cozy-minilog' | ||
|
||
const log = Minilog('📍 Geolocation') | ||
|
||
export const getTs = (location: { timestamp: string }): number => { | ||
return parseISOString(location.timestamp).getTime() / 1000 | ||
} | ||
|
||
export const parseISOString = (ISOString: string): Date => { | ||
const b = ISOString.split(/\D+/) | ||
// @ts-expect-error - Date.UTC() expects number arguments, not stringed numbers | ||
// But at the time of this refactoring, not feeling safe enough to change this | ||
return new Date(Date.UTC(b[0], --b[1], b[2], b[3], b[4], b[5], b[6])) | ||
} | ||
|
||
const Logger = BackgroundGeolocation.logger | ||
|
||
export const Log = (message: string): void => { | ||
log.debug(message) | ||
Logger.debug(message) | ||
} | ||
|
||
export const getAllLogs = async (): Promise<string> => { | ||
return Logger.getLog() | ||
} | ||
|
||
export const sendLogFile = (): Promise<boolean> => { | ||
return Logger.emailLog('') | ||
} |
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
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
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
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
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.
@paultranvan is it okay for you?
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.
I'm not sure what it means for CozyGPSMemory: will it require some extra ts config?
I'm a bit worried that it may introduce more harm than good
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.
I don't think it should impact CozyGPSMemory, I think the issue here could be an unexpected behaviour at runtime with the casting to Number explicitly (this was required for stronger type inference).
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.
I'm not sure what you imply here: do you mean an issue could arise if the variable is actually not a number (which is normal), or that this issue could arise anyway?
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.
I removed runtime modifications