Skip to content

Preceding statements for class member initializers end up in file scope #1208

@Perryvw

Description

@Perryvw
class MyClass {
    myField = false ?? true;
}

Transpiles to

local ____temp_0 = false
if ____temp_0 == nil then
    ____temp_0 = true
end
local MyClass = __TS__Class()
MyClass.name = "MyClass"
function MyClass.prototype.____constructor(self)
    self.myField = ____temp_0
end

Expected output:

local MyClass = __TS__Class()
MyClass.name = "MyClass"
function MyClass.prototype.____constructor(self)
    local ____temp_0 = false
    if ____temp_0 == nil then
        ____temp_0 = true
    end
    self.myField = ____temp_0
end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions