Skip to content

Wrong static properties initializing order - broken recently #1457

@rhazarian

Description

@rhazarian

Hello! The following no longer works.

class A {
    static a = A.foo()

    static foo(): number {
        return 5
    }
}

console.log(A.a)

It should output 5, but fails with an exception.

I've just updated from 1.12.1 to 1.16.1 and encountered this issue, I'm pretty much sure it worked correctly in 1.12.1, so it must have been broken somewhere in-between.

TSTL playground link: https://typescripttolua.github.io/play/#code/MYGwhgzhAECC0G8BQ1XQgFzBglsaY0AvHAHQBmA9pQBQCUSKam2e0VtdAXNAHYCuAWwBGAUwBOiJmjTjRGfuN7QArNOgBfJFqTBKvCJRCjSISgHMasUmAZA

TS playground link:
https://www.typescriptlang.org/play?#code/MYGwhgzhAECC0G8CwAoa7oQC5iwS2GjGgF44A6AMwHtqAKASlVQ0x30JvoYC5oA7AK4BbAEYBTAE6IWrDJPFZBk-tACss9AF9UOlKmDV+EaiHHkQ1AOZ1Y5MAyA

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