google/closure-compiler

es6 classes should copy parent class constructor signature

Aperta

#2583 aperta il 28 lug 2017

 (3 commenti) (0 reazioni) (0 assegnatari)Java (1197 fork)batch import
P3help wanted

Metriche repository

Star
 (7176 stelle)
Metriche merge PR
 (Merge medio 3g 4h) (1 PR mergiata in 30 g)

Descrizione

class Parent {
  /** @param {string} value */
  constructor(value) {}
}

class Child1 extends Parent {}
class Child2 extends Parent {
  /** @override */
  constructor(...args) {
    super(...args);
  }
}
class Child3 extends Parent {
  /** @param {string} value */
  constructor(value) {
    super(value);
  }
}

new Parent(1); // OK
new Child1(1); // NO WARNING
new Child2(2); // NO WARNING
new Child3(2); // OK

Guida contributor