Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

95
Views
Typescript object changes when pushed into an array

I have something very strange happening... I have an array called destinations which takes objects with a dest, an amount and a memo.

My code is the following:

  • I have a variable "element" which (when logged to the console) is a string with value "xNUSrBmqocfTinhSZVV6vLtwzaWasCoYuTUqnERPYjd8CAj3TtAf3hTvsNzoeYRY5b4qFGBS4mZhpXiJDghMKMGuJeD4Qy74ZCe9oMreUuwcRKQVKjj55LUEbnSDPtzH71gyPuT1ft3"
  • But when I create an object and set the dest to this variable and push this object into the destinations array, it suddenly isn't the string above anymore but an object... (take a look at the attached screenshot to see the outputs of the console.logs)
const destinations: { dest: string | never[]; amount: number; memo: string; }[] = [];

console.log("ELEMENT")
console.log(element)
console.log("-----")
                      
destinations.push(
    {
        dest: element,
        amount: 1 * 1e8,
        memo: JSON.stringify(poll),
     }
) 

console.log("DESTINATIONS")
console.log(destinations)
console.log("-----")

enter image description here

Why is this happening?

Thanks in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!