Skip to content

Scala.js facade fails to compile unless you explicitly call js.native #14289

Closed
@AlexITC

Description

@AlexITC

There is a weird behavior when calling native when importing scala.scalajs.js.native.

See this example to reproduce the problem.

Compiler version

3.1.0 (Scala.js)

Minimized code

import scala.scalajs.js.native

@js.native
trait OnTabReplacedDetails extends js.Object {
  val replacedTabId: Int = native
}

Output

[error] -- Error: /scala-js-chrome/bindings/src/main/scala/chrome/webNavigation/bindings/OnTabReplacedDetails.scala:11:27 
[error] 11 |  val replacedTabId: Int = native
[error]    |                           ^^^^^^
[error]    |            Concrete members of JS native types may only call js.native.
[error] one error found

Expectation

The code should behave just like calling js.native.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions