add basic types

This commit is contained in:
Michael Fatemi 2021-04-10 11:24:02 -04:00
parent ed8d9969e0
commit e72b6e5135
3 changed files with 37 additions and 2 deletions

View File

@ -5,7 +5,7 @@
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"start": "node dist/index.js", "start": "tsc; node dist/index.js",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"repository": { "repository": {

View File

@ -0,0 +1,34 @@
namespace Carpool {
interface Group {
id: string;
member_ids: string[];
}
interface User {
id: string;
first_name: string;
last_name: string;
}
interface Comment {
id: string;
body: string;
author_id: string;
}
type Status = "pending" | "cancelled" | "completed" | "interrupted";
interface Post {
id: string;
title: string;
description: string;
participant_ids: string[];
driver_id: string;
create_time: string;
update_time: string;
comments: Comment[];
group_id: string;
status: Status;
capacity: number;
}
}

View File

@ -1,7 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"outDir": "dist/" "outDir": "dist/",
}, },
"files": ["src/types.ts"],
"include": ["src/"], "include": ["src/"],
"exclude": ["node_modules/"], "exclude": ["node_modules/"],
} }