How to use setUserPointer/getUserPointer for collision detections with Ammo.js

I want to print names of colliding objects. I made a very simple example.

I created an object to keep a user data:

        const userData = { name: name }; 

I keep this object in a body using setUserPointer:

body.setUserPointer(userData); 

I try to get this names using getUserPointer and print them. But I get "undefined" instead of names:

function detectCollison(): void {     const dispatcher = physicsWorld.getDispatcher();     const numManifolds = dispatcher.getNumManifolds();      for (let i = 0; i < numManifolds; i++)     {         const contactManifold = dispatcher.getManifoldByIndexInternal(i);         const body0 = contactManifold.getBody0();         const body1 = contactManifold.getBody1();          const p0 = body0.getUserPointer();         const p1 = body1.getUserPointer();          console.log("first object: " + p0.name);         console.log("second object: " + p1.name);     } } 

This is a TypeScript version. I tried to keep names as a body property but it does not work too. It prints "undefined" instead of names:

        (this.body as any).name = name;          physicsWorld.addRigidBody(this.body); 
function detectCollison(): void {     const dispatcher = physicsWorld.getDispatcher();     const numManifolds = dispatcher.getNumManifolds();      for (let i = 0; i < numManifolds; i++)     {         const contactManifold = dispatcher.getManifoldByIndexInternal(i);         const body0 = contactManifold.getBody0();         const body1 = contactManifold.getBody1();          console.log("first object: " + (body0 as any).name);         console.log("second object: " + (body1 as any).name);     } } ```