title: How to convert string [ object object ] into custom type in typescript?
body: <p>I'm using the socket-io query property to transfer an object into the server-side. I have Metadata type declared at both client and server-side.</p>
  <pre><code>//on the client-side
  const metadata: Metadata = {
   id: 'some id',
  }
  
  io(baseUrl ?? '', {
        query: {
          metadata,
        },
   });
  
  //on the server-side
   const query = socket.handshake.query.metadata;
   
   console.log(query); //logs [object object]
   
   console.log(typeof query); //logs string
  
   //error throws here
   const metadata: Metadata = query; //string cannot be assigned to type Metadata
  </code></pre>
  <p>I noticed that query has a type <strong>Record&lt;string,string&gt;</strong> but how to properly convert this into custom type ?</p>