Enum Class CompilerOptions.Es6SubclassTranspilation

java.lang.Object
java.lang.Enum<CompilerOptions.Es6SubclassTranspilation>
com.google.javascript.jscomp.CompilerOptions.Es6SubclassTranspilation
All Implemented Interfaces:
Serializable, Comparable<CompilerOptions.Es6SubclassTranspilation>, Constable
Enclosing class:
CompilerOptions

public static enum CompilerOptions.Es6SubclassTranspilation extends Enum<CompilerOptions.Es6SubclassTranspilation>
Configures the transpiled output for ES6 classes when targeting ES5.

This is needed for transpilation of ES6 classes that extend some unknown superclass, in case that superclass is still a native ES6 class at runtime (not transpiled to ES5).

The default is CONCISE_UNSAFE, which assumes that if a superclass in an extends clause cannot be statically analyzed, it's safe to assume it is an ES5 class.

The "safe" behavior relies on $jscomp.construct, which is our wrapper for Reflect.construct. This is correct, but has the disadvantage of pulling in more helper utilities into the compiled output and of the transpiled output being slightly larger.

TODO: b/36789413 - always enable the "safe" transpilation.

  • Enum Constant Details

  • Method Details

    • values

      public static CompilerOptions.Es6SubclassTranspilation[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CompilerOptions.Es6SubclassTranspilation valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null