-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.ts
47 lines (42 loc) · 1.06 KB
/
interfaces.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
41
42
43
44
45
46
47
interface Game {
title: string;
description: string;
readonly genre: string;
plataform?: string[];
getSimilars?: (title: string) => void
}
const tlou: Game ={
title: "The Last of Us",
description: "The best game in the world",
genre: "Action",
plataform: ["PS3", "PS4"],
getSimilars: (title: string) =>{
console.log(`Similar games to ${title}: Uncharted, A Plague Tale, Metro`);
}
}
console.log(tlou.title);
if(tlou.getSimilars){
tlou.getSimilars(tlou.title);
}
interface DLC extends Game{
originalGame: Game;
newContent: string[];
}
const leftbehind: DLC = {
title: "The Last of Us - Left Behind",
description: "You play as Ellie before the original game",
genre: "Action",
plataform: ["PS4"],
originalGame: tlou,
newContent: ["3 hours story", "new characters"]
}
class CreateGame implements Game{
title: string;
description: string;
genre: string;
constructor(t:string, d:string, g:string){
this.title = t;
this.description = d;
this.genre = g;
}
}