Discuss anything related to web development but no technical support questions


Post by elucian »

Hello, I am trying to implement bryntum-gantt in our Typescript React project, and I seem to be running into some discrepencies regarding the documentation

https://bryntum.com/docs/gantt/#guides/project_data.md

and the type definitions. Here is just one example.

  dependenciesData: [{ fromEvent: 2, toEvent: 3 }], // dependenciesData is of type DependencyModel[]

here is the type.

  export class DependencyModel extends SchedulerProDependencyModel {        
    fromTask: TaskModel;
    toTask: TaskModel;        
    constructor(config?: Partial<DependencyModelConfig>);
  }

as you can see, in the type, the fields fromEvent and toEvent do not exist in the type, yet the documentation guides us to do this.

If I use @ts-nocheck, the component compiles, and it is rendered as expected. I would prefer not to use ts-nocheck on this.

What is the current status of the typescript definitions?


Post by arcady »

Using of fromEvent and toEvent is perfectly valid. Yet it seems we've forgotten to document those field aliases.
And thing is type definitions are generated automatically based on classes docs. That's why the fields definitions are not there..

So far you can simply add them to type definitions manually:

    type DependencyModelConfig = {        
        ...
        fromEvent: TaskModel;
        toEvent: TaskModel;        
    }

  export class DependencyModel extends SchedulerProDependencyModel {        
    ...   
    fromEvent: TaskModel;
    toEvent: TaskModel;        
  }

And here is a ticket I've made for this problem: https://github.com/bryntum/support/issues/1817
Thank you for the feedback!


Post Reply