-
Notifications
You must be signed in to change notification settings - Fork 629
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
First attempt at enable noUncheckedIndexedAccess
TS compiler option
#4039
Conversation
const major = parseInt(groups.major!); | ||
const minor = parseInt(groups.minor!); | ||
const patch = parseInt(groups.patch!); |
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.
Ignoring the lint error with !
as parseInt(undefined)
will parse to NaN
and I've added a new isNaN check below.
if (i >= 0) path = pathSegments[i]; | ||
else { | ||
if (i >= 0) { | ||
path = pathSegments[i]!; |
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
starts at pathSegments.length
and decrements down to -1, however this statement is protected with i >= 0
so the i
should always be inbounds.
for (; newLength > 1 && c.seps.includes(glob[newLength - 1]!); newLength--); | ||
glob = glob.slice(0, newLength); |
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.
It looks like there might be a bug here, the semicolon at the end of the for statement means line below is only ever run once. The for loop itself does nothing.
Great to see this being worked on! Implementing this feature will require a bit of work across the entire codebase. We should create a tracking issue for this to break PRs up. Perhaps, this PR can focus on the sub-modules it already touches. WDYT? |
Never mind, there are many more issues than I first thought. Will spend some more time on this before I submit a PR. |
To elaborate, I think the tracking issue should list each sub-module as a to-do list and include instructions on how to work on the issue. It'd be good to get this done before the Standard Library reaches stability. |
noUncheckedIndexedAccess
TS compiler optionnoUncheckedIndexedAccess
TS compiler option
Implementing as requested in the issue #937