JSSymUtils

object JSSymUtils

Additional extensions for Symbols that are only relevant for Scala.js.

class Object
trait Matchable
class Any

Type members

Classlikes

Companion
class
enum JSName

The result type for sym.jsName.

The result type for sym.jsName.

It is either a literal string, or a computed name represented by a reference to a static Symbol (a dotc.core.Symbols.Symbol, not a js.Symbol).

final
class JSParamInfo(val info: Type, val repeated: Boolean, val capture: Boolean)

Info about a Scala method param when called as JS method.

Info about a Scala method param when called as JS method.

Value Params
capture

Whether the parameter is a capture.

info

Parameter type (type of a single element if repeated).

repeated

Whether the parameter is repeated.

Extensions

Extensions

extension (sym: Symbol)

Should this symbol be translated into a JS bracket access?

Should this symbol be translated into a JS bracket access?

Should this symbol be translated into a JS bracket call?

Should this symbol be translated into a JS bracket call?

Is this symbol a default param accessor for a JS method?

Is this symbol a default param accessor for a JS method?

For default param accessors of constructors, we need to test whether the companion class of the owner is a JS type; not whether the owner is a JS type.

Tests whether the given member is exposed, i.e., whether it was originally a public or protected member of a non-native JS class.

Tests whether the given member is exposed, i.e., whether it was originally a public or protected member of a non-native JS class.

Should this symbol be translated into a JS getter?

Should this symbol be translated into a JS getter?

Is this symbol a default param accessor for the constructor of a native JS class?

Is this symbol a default param accessor for the constructor of a native JS class?

Is this symbol a JS getter or setter?

Is this symbol a JS getter or setter?

Should this symbol be translated into a JS setter?

Should this symbol be translated into a JS setter?

Is this symbol a JavaScript type?

Is this symbol a JavaScript type?

Is this symbol a nested JS class, i.e., an inner or local JS class?

Is this symbol a nested JS class, i.e., an inner or local JS class?

Is this symbol a non-native JS class?

Is this symbol a non-native JS class?

def jsName(using Context): JSName

Gets the unqualified JS name of the symbol.

Gets the unqualified JS name of the symbol.

If it is not explicitly specified with an @JSName annotation, the JS name is inferred from the Scala name.