Skip to content

Instantly share code, notes, and snippets.

@beeblebrox3
Last active August 22, 2018 20:51
Show Gist options
  • Save beeblebrox3/d5b666338935a511ca2a4933c952e31d to your computer and use it in GitHub Desktop.
Save beeblebrox3/d5b666338935a511ca2a4933c952e31d to your computer and use it in GitHub Desktop.
tscp
interface Usuario {
id?: number;
name: String;
}
interface SUsuario {
idUsuario: number;
}
const x: Usuario[] = [{ name: "x" }, { id: 1, name: "y" }];
let y: SUsuario[] = [];
y = x
.filter(d => !!d.id)
.map((usuario) => {
return { idUsuario: usuario.id };
});
console.log(y);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment