Export interfaces that are part of the public API


I’m using Angular v14.1.0 and Mobiscroll v5.17.2.

This issue is similar to the below one:

Issue with exporting interface MbscRecurrenceRule

The above issue was solved in version v5.17.2.

The problem I have now, are with the interfaces MbscCalendarColor and MbscCalendarEventData:

import { MbscCalendarColor } from '@mobiscroll/angular/dist/js/core/shared/calendar-view/calendar-view.types';
import { MbscCalendarEventData } from '@mobiscroll/angular/dist/js/core/shared/calendar-view/calendar-view.types';

Both interfaces are part of the public API of the Event Calendar component but they’re not correctly exported.

To make use of them one has to write the entire path where the TypeScript declaration file is located.

See the following imports:

import { MbscCalendarEventData } from '@mobiscroll/angular/dist/js/core/shared/calendar-view/calendar-view.types';
import {
} from '@mobiscroll/angular';

You can see how it’s preferred to have one entry point from where to import all the interfaces that are part of the public API instead of having to import each interface individually.

Also note, that having to write the entire path where the interface is located could break the application in future releases.

If, in a future release, Mobiscroll changes the location of these interfaces (an implementation detail), any application that depends on them would break.

Hi @Josep_Ponsati

Thank you for the details! I just checked and the MbscCalendarEventData can already be imported and the MbscCalendarColor will be exported too, I just forwarded the request to the developer team. Also, could you please share the context where you’re using the MbscCalendarEventData interface?

Hi @gabi

You’re totally right, the MbscCalendarEventData can already be imported!

My usage is in an Angular application, where I have some custom templates (using ng-template / TemplateRef) defined for the Mobiscroll eventTemplate option.

This templates receives from Mobiscroll an event object. This is the event object I’m referring to:

The template will receive an event object as data. This data can be used to show event specific things on the agenda and popover. The object passed to the template has computed properties, as well as a reference to the original event it comes from…

This templates have user interactions (buttons) where on the click event handlers I pass the event data that Mobiscroll has passed to me (a MbscCalendarEventData if I’m not mistaken).

This object is the one I’m passing to the event handlers and I’m using the interface to make sure the argument in the event handler is correctly typed.

I’m assuming that this object is an MbscCalendarEventData (it’s the only interface I could find that has the original property in it).

Hello @Josep_Ponsati :wave:

Good news: we have shipped Mobiscroll 5.18.2, where we now export the MbscCalendarColor type.

Here you can find a guide of how you can update the Mobiscroll version to the latest: Update guide on the latest version of Mobiscroll for plain JS, jQuery, Angular, Ionic and React.

1 Like