Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Is there support for scala.js in scala 3?


Asked by Travis Prince on Dec 11, 2021 Scala



Yet, until last August, support for Scala.js in Scala 3 was close to non-existent. A first preview was shipped in Dotty 0.27.0-RC1, with support for the portable subset of Scala and native JS types. Since then, support for non-native JS types was added and will ship as part of Scala 3.0.0-M1.
Indeed,
Scala.jsis a compiler that compiles Scala source code to equivalent Javascript code. That lets you write Scala code that you can run in a web browser, or other environments (Chrome plugins, Node.js, etc.) where Javascript is supported.
Accordingly, The Scala plugin extends IntelliJ IDEA’s toolset with support for Scala, SBT, Scala.js, Hocon, and Play Framework. Support for Scala, SBT and Hocon is available for free in IntelliJ IDEA Community Edition, while support for Play Framework and Scala.js is available only in IntelliJ IDEA Ultimate.
In this manner,
From this point on, Scala 3.x releases will only be backwards compatible. This will allow adding new classes and methods in minor releases. Even before that, it is possible to release extensions of the 2.13 library in 3.0 or 3.1. Libraries using these extensions would be restricted to Scala 3 users.
Just so,
Scala doesn’t have undefined (it does have null but its use is discouraged), but instead it has an Option trait for representing optional values. In Scala.js the undefined type exists to support interoperability with JS libraries, but even there it is recommended to use Option whenever possible. Option[A]...