support icon indicating copy to clipboard operation
support copied to clipboard

Typing Issues with eventRenderer

Open chuckn0rris opened this issue 2 years ago • 7 comments

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

chuckn0rris avatar Nov 15 '23 08:11 chuckn0rris

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 avatar Jan 10 '24 20:01 tommy-vigneault-vooban

@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

SergeyMaltsev avatar Jan 11 '24 03:01 SergeyMaltsev

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.

bryandent avatar Feb 15 '24 16:02 bryandent

Hello, any update when this can fixed?

hostrowski04 avatar Feb 28 '24 14:02 hostrowski04

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.

chuckn0rris avatar Feb 28 '24 15:02 chuckn0rris

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 avatar Aug 13 '24 14:08 jon-armen

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

SergeyMaltsev avatar Aug 13 '24 14:08 SergeyMaltsev