Skip to content

Cannot read property 'constructor' of undefined  #237

Closed
@eanderton

Description

@eanderton

I ran into this one when trying to use Go functions that are callable from JavaScript code.

Playground link:
http://www.gopherjs.org/playground/#/A_bP7IWgxi

Basically, $internalize has no code path for 'undefined' values that are mapped to interfaces.

I would like to recommend the following fix, for line 245 in compiler/prelude/jsmapping.go like so:

    if (v === null || v === undefined) {
      return $ifaceNil;
    }

This changes $internalize such that undefined is converted to nil, just like null, for interfaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions