js->clj should convert JavaScript null to Clojure nil


  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test


Prior to commit ebf45f5 [A], js->clj converted JavaScript null to Clojure nil without any errors.

As of commit ebf45f5 (related to CLJS-175), js->clj throws a TypeError when it encounters JavaScript null:

TypeError: Cannot read property 'constructor' of null
b===c}function q(b,c){return,b,c)}function pb(b){return b.construct
TypeError: Cannot read property 'constructor' of null

The attached patch [B] adds a test to demonstrate the issue and provides a suggested fix.

Note: CLJS-175 intentionally limited the types of objects it would attempt to convert to Clojure code. For example, CLJS-175 notes that conversion "doesn't make sense for something like Date or RegExp." I agree for those types of objects, but "null" seems straightforward enough that it should be converted.

[B] Also viewable here:


Vote (0)
Watch (0)


  • Created: