-
Notifications
You must be signed in to change notification settings - Fork 536
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
Prefix trivial issues when enabling no-unchecked-record-access for client packages #23432
Changes from all commits
83e38c5
9cc07a7
3403a09
8ef1cec
126d244
90a1bbe
5d927da
a2deca9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -340,7 +340,7 @@ export function appendSharedStringDeltaToRevertibles( | |
|
||
revertible.intervals.push({ | ||
intervalId: interval.getIntervalId(), | ||
label: interval.properties.referenceRangeLabels[0], | ||
label: interval.properties.referenceRangeLabels?.[0], | ||
Comment on lines
341
to
+343
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. @RishhiB, @alexvy86, @Abe27342, I don't know why TypeScript allows this. |
||
startOffset: offset, | ||
endOffset, | ||
}); | ||
|
@@ -350,7 +350,7 @@ export function appendSharedStringDeltaToRevertibles( | |
endIntervals.forEach(({ interval, offset }) => { | ||
revertible.intervals.push({ | ||
intervalId: interval.getIntervalId(), | ||
label: interval.properties.referenceRangeLabels[0], | ||
label: interval.properties.referenceRangeLabels?.[0], | ||
endOffset: offset, | ||
}); | ||
}); | ||
|
@@ -432,7 +432,7 @@ function revertLocalAdd( | |
revertible: TypedRevertible<typeof IntervalOpType.ADD>, | ||
) { | ||
const id = getUpdatedIdFromInterval(revertible.interval); | ||
const label = revertible.interval.properties.referenceRangeLabels[0]; | ||
const label = revertible.interval.properties.referenceRangeLabels?.[0]; | ||
string.getIntervalCollection(label).removeIntervalById(id); | ||
} | ||
|
||
|
@@ -460,7 +460,7 @@ function revertLocalDelete( | |
string: ISharedString, | ||
revertible: TypedRevertible<typeof IntervalOpType.DELETE>, | ||
) { | ||
const label = revertible.interval.properties.referenceRangeLabels[0]; | ||
const label = revertible.interval.properties.referenceRangeLabels?.[0]; | ||
const collection = string.getIntervalCollection(label); | ||
const start = string.localReferencePositionToPosition(revertible.start); | ||
const startSlidePos = getSlidePosition(string, revertible.start, start); | ||
|
@@ -499,7 +499,7 @@ function revertLocalChange( | |
string: ISharedString, | ||
revertible: TypedRevertible<typeof IntervalOpType.CHANGE>, | ||
) { | ||
const label = revertible.interval.properties.referenceRangeLabels[0]; | ||
const label = revertible.interval.properties.referenceRangeLabels?.[0]; | ||
const collection = string.getIntervalCollection(label); | ||
const id = getUpdatedIdFromInterval(revertible.interval); | ||
const start = string.localReferencePositionToPosition(revertible.start); | ||
|
@@ -539,7 +539,7 @@ function revertLocalPropertyChanged( | |
string: ISharedString, | ||
revertible: TypedRevertible<typeof IntervalOpType.PROPERTY_CHANGED>, | ||
) { | ||
const label = revertible.interval.properties.referenceRangeLabels[0]; | ||
const label = revertible.interval.properties.referenceRangeLabels?.[0]; | ||
const id = getUpdatedIdFromInterval(revertible.interval); | ||
const newProps = revertible.propertyDeltas; | ||
string.getIntervalCollection(label).change(id, { props: newProps }); | ||
|
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.
@RishhiB, @alexvy86, @Abe27342, why do we like this change?
First, the type of
nextVal.value[1]
isILocalValue
in all type evaluation cases. There is no chance ofundefined
here (assuming typing is accurate).Second, this changes the runtime behavior. Before we would throw here if
nextVal.value[1]
was actuallyundefined
; now theundefined
element is stored in the result.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 fact that there was a complaint appears to be a failing of the linter rule. I suspect it doesn't recognize tuples.
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.
My review was only for the devtools changes. I agree in this case the change in runtime behavior is reason enough to undo this bit and the similar ones throughout the PR.
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've opened #23486