core-decorators icon indicating copy to clipboard operation
core-decorators copied to clipboard

suppressWarnings decorator function cannot suppress deprecated decorator function call console.warn output

Open xiaofan9 opened this issue 6 years ago • 0 comments

import { suppressWarnings } from 'core-decorators';

class Person {
  @deprecated
  facepalm() {}

  @suppressWarnings
  facepalmWithoutWarning() {
    console.warn("it is not output"); // not output
    this.facepalm();
  }
}

let person = new Person();

person.facepalmWithoutWarning();
// no warning is logged

The above code actually runs, it will still be able to call console.warn and output the warning, but facepalmWithoutWarning function call console.warn is not output.

image

xiaofan9 avatar Jul 04 '18 01:07 xiaofan9