scala-js-ts-importer
scala-js-ts-importer copied to clipboard
Default values
When I import ts files I often get methods like def this(object: Object3D, size: Double = ???, hex: Double = ???, linewidth: Double = ???) = this()
with a lot of default arguments and corresponding " multiple overloaded alternatives of method "
Maybe for such kind of methods it would be better to generate several methods without defaults, like
def this(object: Object3D) = this()
def this(object: Object3D, size: Double) = this()
def this(object: Object3D, size: Double, hex: Double) = this()
def this(object: Object3D, size: Double, hex: Double, linewidth: Double) = this()
I understand it is verbose but it allows to avoid doing many manual corrections.
I suppose we could try to revert to the verbose way if there are two methods with default arguments.
I don't know if this is the same issue that I'm thinking, but if it is not, I can open another issue.
What about
import scala.scalajs.js.UndefOr
import scala.scalajs.js.undefined
def this(
object: Object3D,
size: UndefOr[Double] = undefined,
hex: UndefOr[Double] = undefined,
linewidth: UndefOr[Double] = undefined) = this()
Could this be a possible solution?
@onilton I don't think this is the same issue, no. The current issue is specifically about the "multiple overloaded alternatives have default arguments" compile error.