Skip to content

Instantly share code, notes, and snippets.

@LayZeeDK
Last active November 2, 2018 10:33
Show Gist options
  • Save LayZeeDK/6d7a662801b25bd392823aa7b82496ec to your computer and use it in GitHub Desktop.
Save LayZeeDK/6d7a662801b25bd392823aa7b82496ec to your computer and use it in GitHub Desktop.
TypeScript: Todo item
class TodoItem {
id: string;
isDone: boolean;
title: string;
save(): Promise<void> {
return fetch("/todo/" + this.id, {
body: JSON.stringify(this),
method: "POST",
})
.then(() => undefined);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment