Last active
August 22, 2018 20:51
-
-
Save beeblebrox3/d5b666338935a511ca2a4933c952e31d to your computer and use it in GitHub Desktop.
tscp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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