Skip to content

Typescript refactor#113

Merged
sergeychernyshev merged 3 commits intocloudflare:mainfrom
thatzopoulos:typescript-refactor
Feb 11, 2026
Merged

Typescript refactor#113
sergeychernyshev merged 3 commits intocloudflare:mainfrom
thatzopoulos:typescript-refactor

Conversation

@thatzopoulos
Copy link
Contributor

@thatzopoulos thatzopoulos commented Feb 6, 2026

All .js files converted to .ts:

  • lib/*.js → src/*.ts
  • index.js → src/index.ts
  • cli.js → src/cli.ts
  • __tests__/.test.js → __tests__/.test.ts
  • __tests__/helpers.js → __tests__/helpers.ts

New TypeScript Config Files:

  • tsconfig.json, jest.config.js, eslint.config.js, src/types.ts, src/ffmpeg.d.ts, src/sitespeed-throttle.d.ts

package.json changes:

  • Added build scripts, changed entry points to dist/, added TypeScript devDependencies

Other:

  • All CLI tests now reference dist/src/cli.js instead of cli.js

  • Updated CLI Args to use slice (non-mutating) instead of splice (mutating)

  • Cleanup test method in src/testRunner.ts is now async and closes the browser instance before removing temp files to prevent Jest open handles

  • Resolves Typechecking #104

@sergeychernyshev
Copy link
Member

As we are on it, let's rename the lib/ to src/ to match the usual convention and move index.ts and cli.ts there as they are no longer directly executable.

@thatzopoulos-cf thatzopoulos-cf marked this pull request as ready for review February 9, 2026 17:31
@thatzopoulos-cf thatzopoulos-cf requested a review from a team February 9, 2026 17:31
Copy link
Member

@sergeychernyshev sergeychernyshev left a comment

Choose a reason for hiding this comment

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

My tests fail locally for some reason - not sure why they run in CI ;(

Still looking through the rest of the code - will submit more comments later today.

Copy link
Member

@sergeychernyshev sergeychernyshev left a comment

Choose a reason for hiding this comment

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

None of these are critical changes, I believe so if you feel like making follow-up tickets for improving types so we can deal with it later, it's fine with me.

Copy link
Member

@sergeychernyshev sergeychernyshev left a comment

Choose a reason for hiding this comment

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

Good to go!

@sergeychernyshev sergeychernyshev merged commit e63e095 into cloudflare:main Feb 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typechecking

3 participants