-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.ts
executable file
·46 lines (41 loc) · 1.42 KB
/
app.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
// type Note = {titel: string, description: string};
import { Note, NoteWithTodos, IamATodo, IamAnArchivedElement } from "./models";
import { NotesService } from "./services/note.service";
import { pluralize } from "./utils/modifiers/pluralize.template";
import { reverse } from "./utils/modifiers/reverse.generic";
const note: Note = new Note(3, "spartakiade", "Hello Developer");
const noteWithTodo: NoteWithTodos = new NoteWithTodos(
1,
"Typescript ist Toll",
"das ist wirklich so",
[
{
title: "Doku lesen",
checked: true,
},
]
);
noteWithTodo.addTodo({
item: { title: "dependencies installieren", checked: false },
position: "first",
});
const notesService: NotesService = new NotesService();
notesService.notes = [
new Note(2, "Developer OpenSpace", "42"),
note,
noteWithTodo,
];
const archivedNote: Note & IamAnArchivedElement = Object.assign(note, {
archiveId: 12,
});
console.log(typeof archivedNote);
// const sortArray: (notes: Note[]) => Note[] = (notes: Note[]) =>
// notes.sort((current, next)=> current.position-next.position);
// console.log(pluralize`NoteCount: ${notesService.notes.length} Notes`);
// console.log(pluralize`NoteCount: ${1} Notes`);
console.log(reverse<Note>(notesService.notes));
console.log(notesService.listTitles(" | "));
[notesService.notes[0], notesService.notes[1]] = [
notesService.notes[1],
notesService.notes[0],
];