Add task method


The method addTask need a string as second parameter as pointed here

The problem with that is that the task created will have a parentId as a string. So when i compare the parent id with the children parent id with a strict equality it will return false as you can see in the example below

So in an angular project (typescript context) I have to use type assertion to avoid problems

Anyway is that only a typing problem ?


You’re right, it’s a typing problem. The second argument is, in fact, optional, gantt will use task.parent value if you omit it.
And it should have the same type as task id - string|number.

I’ve marked it in our tracker for a fix, sorry for the inconvenience