-
Notifications
You must be signed in to change notification settings - Fork 394
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
Strictly Explicit: Enable TypeScript strict mode #333
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
80b2c03
Component props are no longer optional when defaults are provided
Shadowfiend 0179130
Allow and handle optionally undefined UI event handlers
Shadowfiend 289f708
Type react-router-dom location parameters more precisely
Shadowfiend d889ae5
Tighten up renameAndPickKeys types further
Shadowfiend b0e7c49
Make onboarding useState types more explicit
Shadowfiend 5d0056d
Explicitly handle the possibility of null/undefined in UI code
Shadowfiend 5567118
Tighten up a few types in UI code
Shadowfiend caf7a8d
Adjust the way global.crypto is polyfilled in tests for strict mode
Shadowfiend 0dad9f0
Make webpack config strict-mode compatible
Shadowfiend aa7a6b0
Make service types strict-mode compatible
Shadowfiend 2589860
Add explicit null variants to a few types
Shadowfiend 90974fe
Add AnyEVMBlock and use it in most places
Shadowfiend 103be3c
Improve and strictify transaction type hierarchy
Shadowfiend 91adb6b
Adjust JTD validation for strict mode
Shadowfiend 7f17ead
Adjust price validation for strict mode
Shadowfiend 551d82a
Handle a few simple undefined/null possibilities
Shadowfiend 72cd959
Rework redux initialization for strict initialization requirements
Shadowfiend e39fe70
Adapt accounts slice lookup to deal with `to` not being required
Shadowfiend 9d319d9
Specify a tuple type instead of an array type for pricesToSort
Shadowfiend 5b9c67a
Adjust AsyncThunk utilities for strict mode
Shadowfiend 535a74e
Slight type adjustments in KeyringService to handle nulls
Shadowfiend e790884
Fix a place where we expected only Error objects to be thrown
Shadowfiend 6adfe9e
Adjust to updated null/undefined typing in a few places
Shadowfiend 2f33612
Adjust block lookup to reflect possibly-unconfirmed transaction
Shadowfiend 57756a1
In case price lookup fails, log the original error
Shadowfiend 0f30aa8
Rework Blocknative API key to disable block prices without a key
Shadowfiend 1aab12a
Adjust logger to handle potentially-missing stack trace
Shadowfiend 2639036
Enable TypeScript strict mode
Shadowfiend c789691
Fix a precision bug in indexing service price handling
Shadowfiend c657b80
Improve setShowingActivityDetail typing in UI slice
Shadowfiend 6d72e59
Correctly pull validation errors into lazy wrappers
Shadowfiend 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 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 |
---|---|---|
|
@@ -58,7 +58,7 @@ function genericLogger(level: LogLevel, input: unknown[]) { | |
|
||
console.log(...input) | ||
|
||
const stackTrace = new Error().stack.split("\n").filter((line) => { | ||
const stackTrace = new Error().stack?.split("\n")?.filter((line) => { | ||
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. Oh this is much simpler than your previous attempt, I like it 👍 |
||
// Remove empty lines from the output | ||
// Chrome prepends the word "Error" to the first line of the trace, but Firefox doesn't | ||
// Let's ignore that for consistency between browsers! | ||
|
@@ -69,9 +69,11 @@ function genericLogger(level: LogLevel, input: unknown[]) { | |
return true | ||
}) | ||
|
||
// The first two lines of the stack trace will always be generated by this | ||
// file, so let's ignore them. | ||
console.log(stackTrace.slice(2).join("\n")) | ||
if (typeof stackTrace !== "undefined") { | ||
// The first two lines of the stack trace will always be generated by this | ||
// file, so let's ignore them. | ||
console.log(stackTrace.slice(2).join("\n")) | ||
} | ||
console.groupEnd() | ||
} | ||
|
||
|
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.
This indentation is horrendous, I hope the linter made you do 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.
One step further, the linter actually did it for me lol.
There's a world where we introduce a couple of convenience type guards that handle non-null, non-undefined, and non-null-or-undefined... But there weren't as many places where it was needed as I expected, so I stayed away from factoring it out for now.