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

125
Views
Pass keys from type to object in Typescript

This is probably a very trivial question, but after reading other answers on typescript, my head is exploding.

Lets say I have a type of User fields I want to get

export type UserFileds = {
  id: User["id"];
  email: User["email"];
  emailVerified: User["emailVerified"];
  image: User["image"];
  name: User["name"];
};

Now I need to get all of those fileds from the data I get. This is how I make it before:

const { id, email, emailVerified, image, name } = user as User;
return  { id, email, emailVerified, image, name };

How can I put dynamically all this keys from UserFileds, like:

const { "list of keys of UserFileds" } = user as User;

Thanks

about 4 years ago · Santiago Trujillo
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!