Skip to content
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

chore: Migrate TaskQueue to TypeScript #5658

Merged
merged 1 commit into from Apr 17, 2020
Merged

chore: Migrate TaskQueue to TypeScript #5658

merged 1 commit into from Apr 17, 2020

Conversation

jackfranklin
Copy link
Collaborator

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> where T will be what's returned from the queue, but
    because 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 that
    entry from externs.d.ts in favour of importing it and using the type
    directly. 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.

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>` where `T` will be what's returned from the queue, but
because 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 that
entry from `externs.d.ts` in favour of importing it and using the type
directly. 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`.
@jackfranklin jackfranklin added this to the TypeScript migration milestone Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants