Skip to content

Remove void when using a setter from a class binding #3487

@MangelMaxime

Description

@MangelMaxime

Description

Can we remove the void from generated code or does it serve a purpose in this case?

It doesn't impact the performance but impact the bundle size and make the output less clean.

I think the void here protect from nothing.

Repro code

REPL](https://fable.io/repl/#?code=PYBwpgdgBAYghgIwDZgHQGFgCcwFgBQBA2gDwCSAtiNgC4AUARAMoCWA5hHDQK44ASYJCAYAaKAwBuAZwDGwACZgGASgB8AXQI0AnuCisOXXmAFC6yqAF4CUW1ApgKCMFigS4SKFPaceOKVAAXFAASmDeAF5gAIJYWHDaJMAIAFaqVlC+LBJgAPIQSNpQAO4sNAAWUGxgNGJSNTZ2Dk4uUAD6bajehn7hAExQjXZ2pRVVNVDmGVk5+YUkYZExcQlJqaqqQ8NQcBDyXhN0bUGh4SxRsfGJyWkWlplc2XkF2gQEKDRQOJ-3Br7GphA5gI3y6PiM-lQ0Xk8joEG4SCQyhBNTBPWMUj6UJhcIRSIIQA&html=Q&css=Q).

open Fable.Core

[<Import("SignatureHelp", "vscode")>]
type SignatureHelp() =
    member val signatures : ResizeArray<obj> = nativeOnly with get, set
    member __.signatures2 
        with get () = nativeOnly<ResizeArray<obj>>
        and set (_ : ResizeArray<obj>) = nativeOnly

let ret = SignatureHelp()
ret.signatures.Add(null)
ret.signatures2.Add(null)

generates

import { SignatureHelp } from "vscode";
import { defaultOf } from "fable-library/Util.js";

export const ret = new SignatureHelp();

void (ret.signatures.push(defaultOf()));

void (ret.signatures2.push(defaultOf()));

Related information

  • Fable version: 4.1.3
  • Operating system

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