Making generated key value in string type


I have a question regarding type (string/number) of key property.
I’m trying to solve key property type inconsistancy issue.
What I see is that all user interaction, lets say adding node to diagram, adding new links between nodes in diagram, gojs generate key value for both nodes&links in number type. Although key prop accepts string|number|undefined according to API description.
Is there any way to affect key generation? For example make all generated by gojs keys strictly in string type?
I know that i can catch relevant objects (links/nodes) in diffeerent diagram events, and mutate them in the way i need, but this way i will need to handle all possible diagram events that can creates objects, (i can think of at least 3 events objectDropped, linkDrawn, ClipboardPasted straight away), which i dont really want to do.
I’m thinking of adding a comparison method (which will solve type inconsistancy) and use it everywhere we do key comparison, but before that i want to check if there is a way to make gojs generate key in string type only.


You want to set makeUniqueKeyFunction before you add any node data to the model.

Also makeUniqueLinkKeyFunction for link data.