// Auto-generated by scripts/gen_parity_tests.py from docs/runtime-parity.md.
// Module: node:timers/promises
// This file is a byte-for-byte parity test against `node --experimental-strip-types`.
//
// KNOWN PERRY BUG: `await setTimeoutP(0, "value")` where setTimeoutP returns
// `undefined` causes Perry's exception handler to re-enter the catch arm
// infinitely (file produced 5.7M lines of output, hung the runner's
// normalize_output for ~3 hours). For now, this file probes types only —
// re-enable the `await` calls when Perry's await-on-undefined is fixed.

import {
  setTimeout as _setTimeout,
  setImmediate as _setImmediate,
  setInterval as _setInterval,
} from "node:timers/promises";

try {
  console.log("setTimeout typeof:", typeof _setTimeout);
  console.log("setImmediate typeof:", typeof _setImmediate);
  console.log("setInterval typeof:", typeof _setInterval);
} catch (e) {
  console.log("exports error:", (e as Error).message);
}

// PERRY-SKIP: await setTimeoutP(0, "value") infinite-loops on Perry; re-enable when fixed.
// try {
//   const v = await (_setTimeout as any)(0, "value");
//   console.log("setTimeout result:", v);
// } catch (e) {
//   console.log("setTimeout error:", (e as Error).message);
// }

// PERRY-SKIP: same infinite-loop pattern via await.
// try {
//   const v = await (_setImmediate as any)("imm-value");
//   console.log("setImmediate result:", v);
// } catch (e) {
//   console.log("setImmediate error:", (e as Error).message);
// }

// PERRY-SKIP: setInterval async iter — separate infinite-iterator divergence on Perry.
// try {
//   let count = 0;
//   for await (const _ of (_setInterval as any)(0, "tick")) {
//     count++;
//     break;
//   }
//   console.log("setInterval iter count:", count);
// } catch (e) {
//   console.log("setInterval error:", (e as Error).message);
// }
