Use  Object.getPrototypeOf(elem) == GeneratedConstructor.prototype for checking actual type of the custom element