Open chuckn0rris opened 10 months ago
Any updates on this?
With the new "strict" typing of eventRenderer and renderer (5.6.x), is there still a way to use custom event fields on eventRecord without having typing errors?
@tommy-vigneault-vooban
You can declare custom EventModel:
class AppEventModel extends EventModel {
declare customField: number;
static override get fields() : object[] {
return [
{ name : 'customField', type : 'number' }
];
}
}
then use this model class for the store config
const schedulerConfig: Partial<SchedulerConfig> = {
crudManager : {
eventStore : {
modelClass : AppEventModel
}
},
}
and use in code after
(eventRecord as AppEventModel).customField
Hi. Is there any update on this? While casting is an option, that's really just meant to satisfy the compiler and doesn't resolve the underlying issue.
Hello, any update when this can fixed?
Hi, No news yet. It's marked as high prio, we are doing our best. You can subscribe on ticket updates to be notified when it's done. There is also a workaround in comments above to not block you with that.
Reaching out on this again. The same concern is also valid against the new event listeners and types added with the 6.0 Scheduler Pro release where the type mappings are mapped to SchedulerEventModel and SchedulerResourceModel rather than EventModel and ResourceModel
@jon-armen this part has not been fixed yet. Please use the workaround above.
Forum post
Hello-
With the additional typings for TypeScript in the 5.6.0 release, we have noticed that we need to override some of them in order to get things to build correctly.
EventRenderer on SchedulerProConfig: eventRecord is SchedulerEventModel instead of EventModel, resourceRecord is SchedulerResourceModel instead of ResourceModel, in the detail.renderData.row.grid can be a Grid or SchedulerPro
Can you confirm our findings?
Thanks, Bryan