chore: Migrate TaskQueue to TypeScript #5658
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a simple module but took a bit of work because:
It wraps a Promise that can return basically anything. In a pure TS
codebase we'd solve these with generics, so you could do
new TaskQueue<T>
whereT
will be what's returned from the queue, butbecause we're calling that from JS we can't yet. I've left a TODO and
once we migrate the call sites to TS we can do a much better job than
the
void | any
type I've gone with for now.It was used in typedefs via
Puppeteer.TaskQueue
. I've removed thatentry from
externs.d.ts
in favour of importing it and using the typedirectly. This does mean that we have imports that ESLint doesn't
realiase are actually used but I think this is better than maintaining
externs.d.ts
.