Javascript Messages API Error
You need to make sure your library declares a dependency on core/drupal.message, e.g.

foo:
  js:
    js/foo.js: {}
  dependencies:
    - core/drupal.message


Once you've done that, you can choose the message type by including options:

const messages = new Drupal.Message();
messages.add('test message', { type: 'status' });