Description
webworker lib Update Request
Missing / Incorrect Definition
Today, ExtendableEvent
's waitUntil
accepts any
. A common mistake is to pass it a function, expecting the engine to call it. It doesn't, and will silently fail.
This is defined here:
TypeScript/lib/lib.webworker.d.ts
Line 1542 in cec2fda
I would argue this needs to be typed as Promise<any>
rather than any
. This will catch two mistakes:
- Passing a function, expecting it will be called
- Passing a value, expecting it won't be called right away (eg:
waitUntil(longTask());
, withlongTask
a non-async function).
Documentation Link
https://developer.mozilla.org/en-US/docs/Web/API/ExtendableEvent/waitUntil