Skip to content
This repository was archived by the owner on Aug 4, 2023. It is now read-only.

Refer to Promise functions via the Promise object in FFI #1

Merged
merged 1 commit into from
Mar 30, 2020
Merged

Refer to Promise functions via the Promise object in FFI #1

merged 1 commit into from
Mar 30, 2020

Conversation

thomashoneyman
Copy link
Contributor

@thomashoneyman thomashoneyman commented Mar 30, 2020

Use the functions defined in Web.Promise.Internal via the FFI (resolve, etc.) on master and you'll see an error like:

UnhandledPromiseRejectionWarning: TypeError: #<Object> is not a constructor
  at Object.resolve (<anonymous>)
  at ...

@natefaubion did a brief console session and noticed:

>> var a = Promise.resolve

>> a
function resolve()

>> a(12)
TypeError: Receiver of Promise.resolve call is not a non-null object

and

>> var b = { a: Promise.resolve }

>> b.a(12)
TypeError: b is not a constructor

The adjusted exports in the FFI file avoid these issues.

@natefaubion natefaubion merged commit 95243a4 into purescript-deprecated:master Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants