Skip to content

Commit 0a4b5c6

Browse files
committed
refactor: remove JS->TS migration notes from code comments
1 parent e59cc9a commit 0a4b5c6

3 files changed

Lines changed: 4 additions & 16 deletions

File tree

benchexec/tablegenerator/react-table/src/components/Table/FilterInputField.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,13 @@ function FilterInputFieldComponent({
3838
const initFilterValue = setFilter?.value ?? "";
3939

4040
const ref = useRef<HTMLInputElement | null>(null);
41-
// NOTE (JS->TS): Changed from string to timeout handle type because setTimeout/clearTimeout work with a timer id, not text.
4241
const [typingTimer, setTypingTimer] = useState<
4342
ReturnType<typeof setTimeout> | undefined
4443
>(undefined);
4544
const [value, setValue] = useState<string>(initFilterValue);
4645

4746
useEffect(() => {
4847
if (focusedFilter === elementId) {
49-
// NOTE (JS->TS): Optional chaining prevents a crash if the ref is not set yet.
5048
ref.current?.focus();
5149
}
5250
}, [focusedFilter, elementId]);
@@ -65,7 +63,6 @@ function FilterInputFieldComponent({
6563
setTypingTimer(
6664
setTimeout(() => {
6765
setCustomFilters({ id, value: newValue });
68-
// NOTE (JS->TS): document.getElementById may return a non-input element or null, so we guard before focusing.
6966
const el = document.getElementById(elementId);
7067
if (el instanceof HTMLInputElement) {
7168
el.focus();

benchexec/tablegenerator/react-table/src/components/Table/MinMaxFilterInputField.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@ function MinMaxFilterInputFieldComponent({
3939
const initFilterValue = setFilter?.value ?? "";
4040

4141
const ref = useRef<HTMLInputElement | null>(null);
42-
// NOTE (JS->TS): Use the proper timer handle type for setTimeout/clearTimeout instead of a string.
4342
const [typingTimer, setTypingTimer] = useState<
4443
ReturnType<typeof setTimeout> | undefined
4544
>(undefined);
4645
const [value, setValue] = useState<string>(initFilterValue);
4746

4847
useEffect(() => {
4948
if (focusedFilter === elementId) {
50-
// NOTE (JS->TS): Guard against null ref during initial render.
5149
ref.current?.focus();
5250
}
5351
}, [focusedFilter, elementId]);
@@ -62,7 +60,6 @@ function MinMaxFilterInputFieldComponent({
6260
setTimeout(() => {
6361
setCustomFilters({ id, value: newValue });
6462

65-
// NOTE (JS->TS): document.getElementById can return null or a non-input element, so guard before focusing.
6663
const el = document.getElementById(elementId);
6764
if (el instanceof HTMLInputElement) {
6865
el.focus();

benchexec/tablegenerator/react-table/src/components/Table/StatusFilter.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const SPECIAL_CATEGORIES: Record<SpecialCategory, string> = {
2121
[RUN_ABORTED]: "—",
2222
};
2323

24-
// NOTE (JS->TS): Type guard for `SpecialCategory`
2524
function isSpecialCategory(x: string): x is SpecialCategory {
2625
return x in SPECIAL_CATEGORIES;
2726
}
@@ -33,10 +32,10 @@ type TrailingSpace = `${string} `;
3332
* ========================================================================== */
3433

3534
type RelevantFilterParam = Readonly<{
36-
categoryFilters: ReadonlyArray<string>;
37-
statusFilters: ReadonlyArray<string>;
38-
categoryFilterValues: ReadonlyArray<string>;
39-
statusFilterValues: ReadonlyArray<string>;
35+
categoryFilters: ReadonlyArray<string>; // The category filters that are currently selected
36+
statusFilters: ReadonlyArray<string>; // The status filters that are currently selected
37+
categoryFilterValues: ReadonlyArray<string>; // All selectable category filter values
38+
statusFilterValues: ReadonlyArray<string>; // All selectable status filter values
4039
}>;
4140

4241
/* ============================================================================
@@ -77,7 +76,6 @@ const createRelevantFilterLabel = ({
7776
if (!hasSameEntries(categoryFilters, categoryFilterValues)) {
7877
// If categoryFilters is a superset of categoryFilterValues,
7978
// we know that all categories are selected
80-
// NOTE (JS->TS): Copy the array to avoid mutating the original
8179
out = [...categoryFilters];
8280
}
8381
if (!hasSameEntries(statusFilters, statusFilterValues)) {
@@ -103,7 +101,6 @@ function StatusFilter({
103101
setCustomFilters,
104102
}: StatusFilterProps): JSX.Element {
105103
const categoryValues = allCategoryValues[runSetIdx][columnIdx];
106-
// NOTE (JS->TS): Keep `filteredColumnValues` as `unknown` and cast only at the boundary for `pathOr`.
107104
const filteredColumnValuesRecord = filteredColumnValues as Record<
108105
string,
109106
unknown
@@ -133,7 +130,6 @@ function StatusFilter({
133130
const multipleSelected =
134131
selectedFilters.length > 1 || selectedFilters[0] === emptyStateValue;
135132
const singleFilterValue = selectedFilters && selectedFilters[0];
136-
// NOTE (JS->TS): Type guard for `selectValue`
137133
const selectValue: string =
138134
(allSelected && "all ") ||
139135
(multipleSelected && "multiple") ||
@@ -166,7 +162,6 @@ function StatusFilter({
166162
<optgroup label="Category">
167163
{categoryValues
168164
.filter((category) => !isSpecialCategory(category))
169-
// NOTE (JS->TS): Slice to create a copy of the readonly array
170165
.slice()
171166
.sort()
172167
.map((category) => (
@@ -183,7 +178,6 @@ function StatusFilter({
183178
<optgroup label="Status">
184179
{allStatusValues[runSetIdx][columnIdx]
185180
.filter((status) => status !== statusForEmptyRows)
186-
// NOTE (JS->TS): Slice to create a copy of the readonly array
187181
.slice()
188182
.sort()
189183
.map((status) => (

0 commit comments

Comments
 (0)