Premium support for our pure JavaScript UI components


Post by gismya »

Hello!

I am currently working on implementing the Bryntum Scheduler Pro in TypeScript.
I've run into issues where configuration objects have all their attributes as required when they are not.

This particular example is when creating a calendar using a "Partial<CalendarModelConfig>[]". The "intervals" attribute on "CalendarModelConfig" is then optional, but since I want to add intervals I want to use it, and then it incorrectly requires a CalendarIntervalModel[]. The CalendarIntervalModel[] has nothing optional and thus would have me add unnecessary and often contradictory attributes - for example, "endDate" and "recurrentEndDate".

Is this a bug with the types that will be fixed, or is this something you have an intended way we should work around? And if this is a bug, as I assume it is, do you have a preferred avenue to report typescript bugs outside forum threads?


Post by marcio »

Hey gismya,

Thanks for the report, it shouldn't be mandatory to have all the properties in the intervals as you described. I created a ticket to fix it https://github.com/bryntum/support/issues/6390

We prefer to have that registered in the forums just like you did, that's the best way for us to check what our users need. :)

Best regards,
Márcio


Post by johan.isaksson »

Hi,

This one is a bit tricky. It accepts either records of CalendarModel type, or data objects for it. But when you access it later, you get a Store.

I'll document it as:

@field {Core.data.Store} intervals
@accepts {SchedulerPro.model.CalendarIntervalModel[]|CalendarIntervalModelConfig[]}

Which yields this typing:

intervals: CalendarIntervalModel[]|Partial<CalendarIntervalModelConfig>[]|Store

The version of TypeScript we are using does not allow distinguishing between input and output types, so I think that is the best we can offer for now.

Best regards,
Johan Isaksson

Post by gismya »

Thank you. That looks like a good solution.


Post Reply