Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Calling `sleep()` causes `TypeError: can't convert null to BigInt`

Open
#134 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, swift, wasm

Research direction

Reproduce the failure with the linked swiftwasmsleep project and the provided Swift snippet. Start by tracing poll_oneoff in node_modules/@wasmer/wasi/lib/index.esm.js and its call from startWasiTask in entrypoint/dev.js. Done means sleep(1000) completes without the BigInt TypeError and the program prints "After sleep()".

Written by the indexing model from the issue text.

Description

bug

Title says it. Code:

import Foundation
import JavaScriptKit

print("Before sleep()")
sleep(1000) // wasm bails out
print("After sleep()") // Never happens

Project for the above code: https://github.com/ShonFrazier/swiftwasmsleep

The full error is:

 TypeError: can't convert null to BigInt
     poll_oneoff webpack:///./node_modules/@wasmer/wasi/lib/index.esm.js?:128
     start webpack:///./node_modules/@wasmer/wasi/lib/index.esm.js?:131
     startWasiTask webpack:///./entrypoint/dev.js?:92
     async* webpack:///./entrypoint/dev.js?:103
     js http://127.0.0.1:8181/dev.js:97
     __webpack_require__ http://127.0.0.1:8181/dev.js:20
     <anonymous> http://127.0.0.1:8181/dev.js:84
     <anonymous> http://127.0.0.1:8181/dev.js:87
 dev.js:96:11
     handleError webpack:///./entrypoint/dev.js?:96
     (Async: promise callback)
     <anonymous> webpack:///./entrypoint/dev.js?:103
     js http://127.0.0.1:8181/dev.js:97
     __webpack_require__ http://127.0.0.1:8181/dev.js:20
     <anonymous> http://127.0.0.1:8181/dev.js:84
     <anonymous> http://127.0.0.1:8181/dev.js:87
Dominant language
Swift
Stars
986
Forks
76
Avg merge
21h 11m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from swiftwasm/JavaScriptKit

All issues in swiftwasm/JavaScriptKit

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.