-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTeste.ts
40 lines (35 loc) · 1015 Bytes
/
Teste.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Inicial:
// function enviarEmail (para, id, assunto, texto){
// // Regra de negócio
// console.log(para, id, assunto, texto);
// }
// class EnviarEmailParaUsuario{
// send(){
// enviarEmail("[email protected]", 9899, "Olá!", "Tudo bem?");
// }
// }
interface DadosDeEnviarEmail {
para: string;
id: string;
assunto: string;
texto: string;
}
// Função com os tipos definidos
//function enviarEmail(para: string, id: string, assunto: string, texto: string){
// Função usando a interface
//function enviarEmail(dados: DadosDeEnviarEmail) {
// Função desestruturada
function enviarEmail({ para, id, assunto, texto }: DadosDeEnviarEmail) {
console.log(para, id, assunto, texto);
}
class EnviarEmailParaUsuario {
send() {
//enviarEmail("[email protected]", "9899", "Olá!", "Tudo bem?");
enviarEmail({
para: "[email protected]",
id: "9899",
assunto: "Olá!",
texto: "Tudo bem?"
});
}
}