-
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
refactor(assert): prepare for noUncheckedIndexedAccess
#4045
refactor(assert): prepare for noUncheckedIndexedAccess
#4045
Conversation
value: B[b]!, | ||
}); | ||
b -= 1; | ||
} else if (type === ADDED) { | ||
result.unshift({ | ||
type: swapped ? DiffType.added : DiffType.removed, | ||
value: A[a], | ||
value: A[a]!, | ||
}); | ||
a -= 1; | ||
} else { | ||
result.unshift({ type: DiffType.common, value: A[a] }); | ||
result.unshift({ type: DiffType.common, value: A[a]! }); |
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 feel a bit unsure about this one. We can't say for certain if these indices are correct as it's all dependent on if routes
was built correctly.
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 unsure what to do here too. @kt3k, WDYT?
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.
diff
is hugely used across Deno ecosystem (via assertEquals
). I don't think this includes such basic bugs. I think it's fine to use non null assertion here.
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.
Best to review this as 4 separate bits:
- createCommon: small and simple
- backTrace: small risk but ultimately ignoring with
!
- createFP / snake / ensureDefined / the bits where currentFP is used: this was a messy situation and the types were lying, now marking
FarthestPoint
as being possibly undefined in more places, and needing to handle new cases of missing values. - diffstr (tokenize / createDetails): a few new
const
s and type tweaks, nothing crazy
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Changing function (
slide: FarthestPoint | undefined,
down: FarthestPoint | undefined,
foo: any,
) {} to function (
slide?: FarthestPoint,
down?: FarthestPoint,
foo: any,
) {} is causing the error:
Options are:
Personally I prefer option 1 as we never expect to call the function without those parameters. I'll revert it for now but happy to change to option 2 if you wish. |
Waiting on #4074 to get checks to pass |
Let's do number 1. |
Great, thats already applied as of 8aedb7c |
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.
LGTM
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.
LGTM too
Handling all noUncheckedIndexedAccess issues for the assert module, tracked in #4040