Skip to content

Instantly share code, notes, and snippets.

@jhegedus42
Created November 29, 2016 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhegedus42/9c478a07ff4244dac7581424d88a2e1c to your computer and use it in GitHub Desktop.
Save jhegedus42/9c478a07ff4244dac7581424d88a2e1c to your computer and use it in GitHub Desktop.
@js.native
trait Props extends js.Object {
var value: String = js.native
var index: Int = js.native
var key: String = js.native
}
case class ScalaProps(val value:String, val index:Int, val key:String)
// how do i convert ScalaProps to Props ?
def testCompBScala(sp:ScalaProps)={
val p=js.use(sp).as[Props]
TestCompB(p)
}
gives :
104. Waiting for source changes... (press enter to interrupt)
[info] Compiling 1 Scala source to /Users/joco/dev/scala.js/react/sjs-playaround/stable/target/scala-2.11/classes...
[error] /Users/joco/dev/scala.js/react/sjs-playaround/stable/src/main/scala/example/ScalaJSExample.scala:80: example.SortableItem.ScalaProps does not export a setter value: String.
[error] val p=js.use(sp).as[Props]
[error] ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 1 s, completed Nov 29, 2016 10:11:07 PM
105. Waiting for source changes... (press enter to interrupt)
for line 13 here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment