`(js->clj #js {:constructor true})` fails to produce a CLJS value

Description

(js->clj #js {:constructor true}) does not return a map or a CLJS value, and instead it returns #object[Object [object Object]].

It's still possible to obtain a CLJS value from that JSON data by using transit though.

Below is a full repro:

Environment

None

Activity

Show:
Filipe Silva
November 20, 2020, 4:32 PM
Edited

“p-himik” on slack said:

the culprit is the way the type function is implemented.

To be more concrete: (assert (true? (type #js {:constructor true}))).

Filipe Silva
November 21, 2020, 10:28 AM

helped me on slack to find a way to use IEncodeClojure to cover this case:

He also said that I could get around the need for the removecall by calling specify! over the prototype (which needs to be added because the object literal doesn’t have one), but I couldn’t quite get it to work and ended up clocking out for the week before trying further.

Assignee

David Nolen

Reporter

Filipe Silva

Labels

None

Approval

Triaged

Patch

None

Priority

Minor