Skip to content

Convert and refactor utility modules to TypeScript#1250

Merged
PhilippWendler merged 19 commits intotypescript-migration/typescript-full-migrationfrom
typescript-migration/migration/utils-folder-new
Feb 20, 2026
Merged

Convert and refactor utility modules to TypeScript#1250
PhilippWendler merged 19 commits intotypescript-migration/typescript-full-migrationfrom
typescript-migration/migration/utils-folder-new

Conversation

@Simon1375
Copy link
Copy Markdown
Contributor

### Summary
This pull request migrates several utility modules and files from JavaScript to TypeScript, improving codebase consistency and type safety. The following files are involved:
- Converted, refactored, and renamed `filters.js` to `filters.ts`
- Converted, refactored, and renamed `stats.js` to `stats.ts`
- Converted, refactored, and renamed `utils.js` to `utils.tsx`
- Converted, refactored, and renamed `plot.js` to `plot.tsx`

Additionally:
- Updated `MIGRATION.md` to mark the `src/utils/` migration as complete.
- Ensured all migrated files compile successfully with necessary fixes.

Copy link
Copy Markdown
Member

@PhilippWendler PhilippWendler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

The new types are quite nice, their names are good.

The PR basically contains a few different kinds of changes:

  • definitions of new types
  • added types for parameters etc.
  • necessary adjustments to satisfy the type checker, like fallbacks for undefined, type casts etc.
  • some cleanup where the old code misused the dynamic typing
  • a few cases where local variables seem to be renamed without reason (filter to f or so)

Except for the 1-2 cases where I left comments I did not see anything where the new code seems to be worse than the old code, mostly it is is a noticeable improvement.

Not sure why there are some renamings that seem to not be motivated by the added types, maybe for future PRs this can be avoided.

Differently from what I had hoped the differences are large enough such that a really thorough review that checks in a detailed manner whether there are behavioral differences would take too much time. This is unfortunate, but I would still continue with the plan and hope that our tests would catch differences. Maybe we can retry a review after finding a way to convert the TS code to similar plain JS code. And at least in the end we should add a round of manual testing of all the functionality.

Some of the added code for satisfying the type checker is ugly, but this does not happen too often. I am optimistic that these cases can eventually be resolved when we continue to improve the code further in general and use types more consistently.

So in total I think this shows that the TS migration (a) works and (b) makes the code significantly better due to the new types and the related improvements. 👍

We can merge this PR after the small cleanups from my comments.

Comment thread benchexec/tablegenerator/react-table/src/utils/stats.ts Outdated
Comment thread benchexec/tablegenerator/react-table/src/utils/stats.ts
Comment thread benchexec/tablegenerator/react-table/src/utils/utils.tsx
Comment thread benchexec/tablegenerator/react-table/src/utils/utils.tsx
@PhilippWendler
Copy link
Copy Markdown
Member

Do you want to remove the comments with migration notes before merging this PR or only before merging into main?

@Simon1375
Copy link
Copy Markdown
Contributor Author

Do you want to remove the comments with migration notes before merging this PR or only before merging into main?

I suggest removing them now.

@PhilippWendler PhilippWendler merged commit 3fbe608 into typescript-migration/typescript-full-migration Feb 20, 2026
15 checks passed
@PhilippWendler PhilippWendler deleted the typescript-migration/migration/utils-folder-new branch February 20, 2026 12:53
@PhilippWendler
Copy link
Copy Markdown
Member

For the record: It seems this PR broke adding filters via the sidebar. #1253 has a fix, if I understand correctly it is this one: #1253 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants