Skip to content

ReferenceError when resource has no functions #221

@tomasol

Description

@tomasol

Having an empty resource:

interface execution {

    resource join-set-id {
        // id: func() -> string;
    }

  new-join-set: func() -> join-set-id;
}

Calling new-join-set from a JavaScript guest fails with an error: ReferenceError: import_execution_1_0_0$JoinSetId is not defined.
This is because the generated initializer.jsdoes not contain class import_execution_1_0_0$JoinSetId {...}, but tries to use it in the generated new-join-set function: var rsc2 = new.target === import_execution_1_0_0$JoinSetId ? this : Object.create(import_execution_1_0_0$JoinSetId.prototype);

The workaround is to add a function, which triggers the class generation.
Tested with componentize-js version 0.18.2 .

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