6.2 typescript declaration file not updated

Hi,

One of the API change was date_format, however, the declaration is not updated.

It is outdated, and still referring to v6.1.0.

Please review, and update.

Probably have some more that wasn’t updated.

Thank you.

Hello Joseph,
Thank you for reporting about that.
We have a bug in our internal tracker that there are some missing types. The dev team will fix it in future updates, but I cannot give you any ETA.
However, if you encounter other missing types, you can list them here, and I will forward them to the dev team.

Hi @ramil

I can’t use it without the correct types right? In that case, I won’t be able to upgrade to 6.2.0?

In that case, I’m losing all the features upgrade in 6.2.0? And there’s no ETA for this?

I can submit a official request if that expedite the process.

– Update
Similar to this, I added a interface to extend the default GanttConfigOptions to add date_format at the moment.

Thanks.

Hello Joseph,
If you use Angular, as a workaround, you can add the following string to allow any types for Gantt:

declare let gantt: any;

When the dev team adds the missing types, you can remove that string.

Hi @ramil,

Setting to any will lose all typings, so I think extending now probably better as a temporary solution.

Hi @ramil,

Missing marker_class in gantt.templates too.

Hi,

Based on this sample.

$container is not inside the typing as well.

Hi,

The typing for scrollTo is defined as

scrollTo(x: number, y: number)

But according to the documentation in here, it states to define null if x or y is not in use.

It’s not possible to pass in null though. I passed in 0 and it seem to be working as the same as far as I can tell.

Please advise.

Hello Joseph,
Thank you for sharing that information. I added it in the tracker.
Unfortunately, I cannot reproduce the issue with the scrollTo method:
http://snippet.dhtmlx.com/5466cc2e6

If you do that from the web console and it doesn’t work, it is strange, but it is hard to suggest what might be wrong as I couldn’t reproduce the issue and I don’t see your code.
If you use it in a function, you need to check that the function is actually called. If it happens in Angular, maybe it is not allowing to pass the value with a different type.

Hi @ramil,

I’m using Typescript.

It’s not an issue per say, it’s more of the type definition.

You define the function scrollTo with 2 parameters that takes in only number.
So I cannot pass in scrollTo(5, null) or scrollTo(null, 5) since null is not a number by definition.

Hence, if scrollTo method can take in null, then it should be defined as scrollTo(x: number | null, y: number | null). This way, I will be able to then pass in null as the argument. Otherwise, if it has to be strictly only number, then your documentation should update to state that?

Otherwise, is there is different with passing scrollTo(5, 0) and scrollTo(5, null)`, is it doing the same thing?


You can visit Typescript Playground, then put in the following.

function scrollTo(x: number, y: number) {
    console.log(x, y);
}

scrollTo(null, 2); // Complains 'Argument of type 'null' is not assignable to parameter of type 'number'.'

Hello Joseph,
Thank you for the clarification and tips. I will forward your tips to the dev team.

Otherwise, is there is different with passing scrollTo(5, 0) and scrollTo(5, null)`, is it doing the same thing?

You can use gantt.scrollTo(5, 0)command instead of gantt.scrollTo(5, null). I didn’t test it in all possible scenarios, but it works correctly in snippets.

Hi @ramil,

I am currently pass 0 instead of null and seem to be quite alright at the moment.

Perhaps 0 might be a better way to pass in as args rather than null. This way, the typing does not need to change. Just the documentation to reflect correctly.

Hopefully all the typing issue could be updated as soon as possible.

Thanks again, will report any more findings here.

Hi @ramil,

Was wondering if the recent release of 6.3.x has any update to correcting the type definitions?

Hello Joseph,
Unfortunately, that bug has not yet been fixed.

Hello Joseph,
I would like to inform you that the dev team added more types in the 8.0 version:
https://docs.dhtmlx.com/gantt/whatsnew.html#x6629x80x6630x:~:text=Updated%20TypeScript%20type%20definitions
https://docs.dhtmlx.com/gantt/whatsnew.html#x6629x80x6630x:~:text=Type%20definitions%20are%20updated

Now there are types for the tasks, links, grid columns, scales, extensions, and almost everything in the others category:
https://docs.dhtmlx.com/gantt/desktop__task_properties.html
https://docs.dhtmlx.com/gantt/desktop__link_properties.html
https://docs.dhtmlx.com/gantt/api__gantt_columns_config.html
https://docs.dhtmlx.com/gantt/api__gantt_scales_config.html
https://docs.dhtmlx.com/gantt/api__gantt_ext_other.html
https://docs.dhtmlx.com/gantt/api__refs__gantt_others.html

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.