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.
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
noUncheckedIndexedAccess in tsconfig #9880
base: develop
Are you sure you want to change the base?
noUncheckedIndexedAccess in tsconfig #9880
Changes from 6 commits
356f18a
2f356a2
260e7fd
5c5d3cd
347fa08
7e25a9b
57c8e5a
2e4e860
6de2db1
46d564d
8671dfd
2a73a31
6fc0471
c667672
321c635
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
would the component work with
""
being passed to the id fields?i mean, the whole reason for adding this strict check is so that it's super safe. i don't see much advantage in enabling this check when we are anyways gonna fallback to empty string.
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.
@rithviknishad you are right. Falling back to an empty string defeats the purpose of strict checks.
I’m planning to display the ErrorPage when the parameters are undefined or invalid:
Does this approach align with what you had in mind?
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.
the root issue seems to be with the implementation of
AppRoutes
type itself. It should've inferred type as string automatically instead, hence these checks wouldn't be needed in the first place.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.
what we have now:
what's expected:
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.
We won't need these checks with #9890 i believe
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 did check after enabling this config in that branch, it still gives string | undefined after enabling it. (atleast it's not never)
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.
@rithviknishad So should i follow this approach to handle the undefined right?
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.
we'll need a better solution than that 😅 this approach is not maintainable. with too many routes, repeating this logic is quite cumbersome.
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.
(there's a reason for the issue being 6 story points) 🙂
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.
@rithviknishad I have found two methods
by 2nd method params are of type any and if we declare the param types as string
Currently trying to finding more methods to infer params as directly string instead of string | undefind or never