bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
53 stars 6 forks source link

Typing Issues with eventRenderer #7868

Open chuckn0rris opened 10 months ago

chuckn0rris commented 10 months ago

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

image

tommy-vigneault-vooban commented 8 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?

SergeyMaltsev commented 8 months ago

@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
bryandent commented 7 months ago

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.

hostrowski04 commented 6 months ago

Hello, any update when this can fixed?

chuckn0rris commented 6 months ago

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.

jon-armen commented 1 month ago

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

SergeyMaltsev commented 1 month ago

@jon-armen this part has not been fixed yet. Please use the workaround above.