Tis is my first post here so let me tell you - I’m in love with your product. Thank you!
I have a problem, though. We develop our app using Pro version and we’re stuck on problems with the typings.
I read this topic: Property does not exist, using Angular 4 since I’m struggling with same exact issue.
My question is: are those types fixed now? If not - when can we suspect a bugfix?
We can’t afford disabling types checking by settings gantt to any type. It is considered anti-pattern and is not allowed in our firm.
It can be that some types are missing as it was reported that there is no type for the gantt.$task property, but mostly, Gantt should have all the necessary types included. If you encounter that issue, please report about it and I will inform the dev team.
If you had 6.0.x or lower version and then you install the 6.1.0 or newer version, you will encounter another issue, now with the duplicate types. To fix it, you need to apply the following command:
npm uninstall @types/dhtmlxgantt -save-dev
And make sure that the types in the tsconfig.app.json file don’t contain "dhtmlxgantt":
thank you for you reply and detailed explanation. Can I report missing typings here in this thread?
I am using version 6.1.7 (since 6.1.7, so no upgrade needs to be performed).
The problem is that following code throws an error:
task.planned_start_date = gantt.date.parseDate(task.planned_start_date as string, 'xml_date');
and the error is:
Property ‘parseDate’ does not exist on type ‘GanttDateHelpers’. ts(2339)
As temporary workaround I’ve created following interface:
export interface FixedGanttDateHelpers extends GanttDateHelpers {
// there are typing missing. See https://forum.dhtmlx.com/t/typings-problem/68089 for the details
parseDate: (date: string, format: string) => Date;
}
task.planned_end_date = (gantt.date as FixedGanttDateHelpers).parseDate(task.planned_end_date as string, 'xml_date');
However, I’d like to avoid such workarounds whenever possible. Can you confirm the types for parseDate are missing or is it only problem on my local machine?
Hello Marcin,
Yes, you can report the missing types here. Recently, it was discovered that the 6.2.0 version has some missing types. So, if you share the missing types, I will forward that information to the dev team, and they will add the types.
However, there is no missing type for the planned_start_date property. It is a custom property (although it is used in our examples), so it wasn’t included in the official types. You can add more properties to the task object, and Gantt will continue working correctly with that, but Angular will tell you that the type is missing, so you will need to add it.
You can update to the latest version to get more features and improvements, including the better Typescript Support.
However, even if you are using the older version and don’t have plans to upgrade, you can still use the updated version of the dhtmlxgantt.d.ts file as the Gantt API is mostly the same:
There are still ways to improve, so in the future versions, the dev team will add more types for Gantt.
1 Like
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan