Coder Social home page Coder Social logo

Comments (4)

Andrei-Pozolotin avatar Andrei-Pozolotin commented on August 30, 2024

this is a work around, but rather verbose:

  @ScalaJSDefined
  trait Mutations extends js.Object {
    def increment(state: State)
    def decrement(state: State)
  }

  val mutations = new Mutations {
    def increment(state: State) = state.count+=1
    def decrement(state: State) = state.count-=1
  }

// works fine:

val name = nameOf(mutations.increment _) 

from scala-nameof.

dwickern avatar dwickern commented on August 30, 2024

Am I correct that this is scalajs specific? It works with java.lang.Object in place of js.Object

from scala-nameof.

Andrei-Pozolotin avatar Andrei-Pozolotin commented on August 30, 2024

yes, there are bunch of restrictions
https://www.scala-js.org/doc/interoperability/sjs-defined-js-classes.html

from scala-nameof.

dwickern avatar dwickern commented on August 30, 2024

From looking at https://www.scala-js.org/doc/interoperability/sjs-defined-js-classes.html#caveat-with-reflective-calls it seems this behavior is intended. I don't think there is anything we can do

from scala-nameof.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.