Subtypes of js.Any are JavaScript types, which have different
semantics and guarantees than Scala types (subtypes of AnyRef and
AnyVal). Operations on JavaScript types behave as the corresponding
operations in the JavaScript language.
By default, JavaScript types are native: they are facade types to APIs
implemented in JavaScript code. Their implementation is irrelevant and
never emitted. As such, all members must be defined with their
right-hand-side being js.native. For forward source
compatibility with the next major version, the class/trait/object itself
should be annotated with @js.native.
In most cases, you should not directly extend this trait, but rather extend
js.Object.
To implement a JavaScript type in Scala.js (therefore non-native), its
declaration must be annotated with
@ScalaJSDefined. Scala.js-defined JS types
cannot directly extend native JS traits; and Scala.js-defined JS traits
cannot declare concrete term members.
It is not possible to define traits or classes that inherit both from this
trait and a strict subtype of AnyRef. In fact, you should think of
js.Any as a third direct subclass of scala.Any, besides
scala.AnyRef and scala.AnyVal.
Root of the hierarchy of JavaScript types.
Subtypes of js.Any are JavaScript types, which have different semantics and guarantees than Scala types (subtypes of AnyRef and AnyVal). Operations on JavaScript types behave as the corresponding operations in the JavaScript language.
By default, JavaScript types are native: they are facade types to APIs implemented in JavaScript code. Their implementation is irrelevant and never emitted. As such, all members must be defined with their right-hand-side being js.native. For forward source compatibility with the next major version, the class/trait/object itself should be annotated with @js.native.
In most cases, you should not directly extend this trait, but rather extend js.Object.
To implement a JavaScript type in Scala.js (therefore non-native), its declaration must be annotated with @ScalaJSDefined. Scala.js-defined JS types cannot directly extend native JS traits; and Scala.js-defined JS traits cannot declare concrete term members.
It is not possible to define traits or classes that inherit both from this trait and a strict subtype of AnyRef. In fact, you should think of js.Any as a third direct subclass of scala.Any, besides scala.AnyRef and scala.AnyVal.
See the JavaScript interoperability guide of Scala.js for more details.