`js.UndefOr` is no longer considered a subtype of `js.Any`
See original GitHub issueCompiler version
- 2.13.5 - pass
- 3.0.0-RC1 - pass
- 3.0.0-RC2 - fail
- 3.0.0-RC3 - fail
Minimized code
import scala.scalajs.js
object Test {
def x: js.UndefOr[Int] = 1
x: js.Any
}
Output
[error] 5 | x: js.Any
[error] | ^
[error] | Found: scala.scalajs.js.UndefOr[Int]
[error] | Required: scalajs.js.Any
[error] one error found
Expectation
Success.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
JavaScript types - Scala.js
Understanding how different types are mapped between Scala.js and JavaScript is crucial for correct interoperability. Some types map quite directly (like ...
Read more >An unboxed js.Option[+A] type with undefined as None #422
Any (including all js.Dynamic inputs), or should it be converted to a runtime representation which is more likely to please the called code?...
Read more >What types are special to the Scala compiler? - Stack Overflow
js.Any : conceptually a third subtype of Any , besides AnyVal and AnyRef . They have JavaScript semantics instead of Scala semantics.
Read more >JavaScript types - 《Scala.js 1.0 Document》 - 书栈网
Understanding how different types are mapped between Scala.js and JavaScript is crucial for correct interoperability.Some types map quite ...
Read more >scala-js/scala-js - Gitter
got it, I believe any subtype of js. ... I know is not magic but it seems far better than typescript and it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
if we just wanted to support conversions from js.UndefOr and not all unions of primitives, we could add an implicit def to https://github.com/lampepfl/dotty/blob/master/library-js/src/scala/scalajs/js/internal/UnitOps.scala in 3.1.
Oh silly me, 99% of the time we
import scala.scalajs.js
, notimport scala.scalajs.js._
which is different to expected usage with most of my own libraries. Ok yep my bad, you’re right.