node create interface options code example

Example: nodejs interface

// MenuInterface.jsclass MenuInterface {  constructor() {    if(!this.getItems) {      throw new Error("Menu's must have items!");    }  }}// ---// file index.jsimport MenuInterface from './MenuInterface';class Menu extends MenuInterface {  // no items}export default new Menu() // Error "Menu's must have items!"// ---// file  baseMenu.jsclass BaseMenu extends MenuInterface {  constructor() {    super();    this.items = [];  }  get getItems() {    return items;  }}export default new BaseMenu();  // No Error, has the method!