Linked Questions

Popular Questions

I've got an array with 100's of attributes that I want to chop down to just a small number in my Type Safe TypeScript object. Here is my code that works but I'm hoping to find a cleaner way that does not make me mention the attribute names twice (avoiding DRY and errors).

const {id = 0,username = '....',userFirstName = '.',userLastName = '..'} = response.data;
const userInfoObj : IUserInfo = {id,username,userFirstName,userLastName};

This is as far as I could figure out. Any suggestions to make it simpler?

Related Questions