We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
@new @variadic
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In JavaScript, constructors can also have a rest parameter, and thus can be variadic.
'use strict'; class Foo { constructor(...names) { this.names = names; } } let foo = new Foo("bar", "baz"); console.log(foo.names);
Currently, ReScript can't easily bind to these variadic constructors because @new @variadic is not supported:
type foo @get external names: foo => array<string> = "names" @new @variadic external makeFoo : array<string> => foo = "Foo" // ^ Conflicting FFI attributes found: Attribute found that conflicts with %@new let foo = makeFoo(["bar", "baz"]) Js.log(foo->names)
As there is no easy workaround to this (especially when the class is imported), I believe @new @variadic should be supported.
The relevant code is here: https://github.com/rescript-lang/rescript-compiler/blob/4419af7d822c7c9dffe21532624810985915908b/jscomp/frontend/ast_external_process.ml#L792-L811
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
In JavaScript, constructors can also have a rest parameter, and thus can be variadic.
Currently, ReScript can't easily bind to these variadic constructors because
@new @variadic
is not supported:As there is no easy workaround to this (especially when the class is imported), I believe
@new @variadic
should be supported.The relevant code is here: https://github.com/rescript-lang/rescript-compiler/blob/4419af7d822c7c9dffe21532624810985915908b/jscomp/frontend/ast_external_process.ml#L792-L811
The text was updated successfully, but these errors were encountered: