exoego / scalajs-types-util

Scala.js types utility to facilitate common type transformations

Version Matrix

scalajs-types-util

Scala.js types utility to facilitate common type transformations

Support matrix

ScalaJS 0.6.28+ ScalaJS 1.x
Scala 2.13 ✔️ ✔️
Scala 2.12 ✔️ ✔️
Scala 2.11 N/A N/A
Scala 2.10 N/A N/A

How to use

Add below line to your SBT project.

libraryDependencies += "net.exoego" %%% "scalajs-types-util" % "0.3.0"
import scala.scalajs.js
import net.exoego.scalajs.types.util.Factory

@Factory
trait Foo extends js.Object {
  var x: Int
  var y: js.UndefOr[String]]
}

val f = Foo(x = 1)
assert(f.x === 1)
assert(f.y === js.undefined)