Skip to content

[JS] Rework how we handle static field on class #4419

Description

@MangelMaxime

static fields in JavaScript are now globally available since 2021 and since 2019 in Node.js V12.

The following F# code

type ClassWithExplicitStaticFields() =
    static let mutable count = 42

    static member Count = count

generates

export class ClassWithExplicitStaticFields {
    constructor() {
    }
}

(() => {
    ClassWithExplicitStaticFields.count = 42;
})();

We could instead generate:

export class ClassWithExplicitStaticFields {
	static count = 42;
    constructor() {
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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