Skip to content

Mistranspilation when calling a static method on a default export class #813

@ElusiveMori

Description

@ElusiveMori
export default class Bug {
    static init() {}
}

Bug.init()

Transpiles to:

require("lualib_bundle");
local ____exports = {}
____exports.default = __TS__Class("Bug")
local Bug = ____exports.default
Bug.name = "Bug"
function Bug.prototype.____constructor(self)
end
function Bug.init(self)
end
____exports.Bug:init()
return ____exports

The mistranspilation is at line ____exports.Bug:init(). ____exports.Bug is never set, resulting in a runtime error when trying to run the code.

Should probably be ____exports.default:init() instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions