chore: Migrate TaskQueue to TypeScript (#5658)

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 commit is contained in:
Jack Franklin
2020-04-17 10:32:56 +01:00
committed by GitHub
parent ef3befa2e6
commit 1a57ba22a8
6 changed files with 50 additions and 23 deletions

View File

@@ -111,7 +111,8 @@ module.exports = {
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": 2,
"semi": 0,
"@typescript-eslint/semi": 2
"@typescript-eslint/semi": 2,
"@typescript-eslint/no-empty-function": 0
}
}
]