You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When writing evaluation functions to be executed in a puppeteer page (e.g. page.evaluate(fn)), it is desirable to have access to the native TS window and DOM types within those functions.
The two environments (Deno and browser) share quite a bit of API overlap, but also have some exclusive parts (e.g. globalThis.Deno in Deno vs window.document in browser, etc.). One simple approach is to include all type libs in a Deno config, like this:
However — because runtime errors will occur when using browser-exclusive APIs in Deno (or Deno-exclusive APIs in browser evaluation functions) — the above approach prevents the compiler from catching these environment-mismatch errors and emitting related diagnostics.
To me, at least, it is desirable to maintain type safety in these independent execution contexts (Deno vs browser). Are there any established patterns for this?
The text was updated successfully, but these errors were encountered:
When writing evaluation functions to be executed in a puppeteer page (e.g.
page.evaluate(fn)
), it is desirable to have access to the native TSwindow
and DOM types within those functions.The two environments (Deno and browser) share quite a bit of API overlap, but also have some exclusive parts (e.g.
globalThis.Deno
in Deno vswindow.document
in browser, etc.). One simple approach is to include all type libs in a Deno config, like this:deno.json
:However — because runtime errors will occur when using browser-exclusive APIs in Deno (or Deno-exclusive APIs in browser evaluation functions) — the above approach prevents the compiler from catching these environment-mismatch errors and emitting related diagnostics.
To me, at least, it is desirable to maintain type safety in these independent execution contexts (Deno vs browser). Are there any established patterns for this?
The text was updated successfully, but these errors were encountered: