The line:
var isSameType = $el.hasClass('alert-' + notification.settings.type);
needs to be changed to:
var isSameType = $el.find('.alert').hasClass('alert-' + notification.settings.type);
otherwise it won't find the element that has the "alert-*" class on it...
(this is for the v4.0.3 taken from https://www.npmjs.com/package/bootstrap4-notify)