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
The program prints hello, then exits with no errors.
Actual Behavior
The following error is printed to the console and the program exits without printing hello:
error TS2345: Argument of type '() => Promise<void>' is not assignable to parameter of type '(event: Event) => void | null'.
Type 'Promise<void>' is not assignable to type 'void'.
► file:///Path/To/CWD/test.ts:1:33
1 window.addEventListener("load", async () => {
Notes
I believe having an async function as an event handler is valid JS/TS, it ran in previous versions of Deno (as recently as v30). Thinking it was probably broken by Enable "strict" mode for runtime code. #3899. If I rename the file to test.js it runs without a problem.
I'm guessing this error being thrown has to do with Deno's type declaration for event handlers. While I'm not familiar enough with the code base to know exactly where the problematic declaration is, these seem like likely candidates
Environment
Steps to Reproduce
test.ts
deno test.ts
Expected Behavior
The program prints
hello
, then exits with no errors.Actual Behavior
The following error is printed to the console and the program exits without printing
hello
:Notes
test.js
it runs without a problem.deno/cli/js/globals.ts
Line 107 in a3bfbcc
deno/cli/js/lib.deno.shared_globals.d.ts
Line 45 in 6cd46fa
deno/cli/js/event_target.ts
Line 38 in dd8a109
deno/cli/js/dom_types.ts
Line 86 in 2b0cf74
The text was updated successfully, but these errors were encountered: