Skip to content

Commit c48f8ad

Browse files
committed
feat(type): provided data types in relation to users
1 parent 66e33b1 commit c48f8ad

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

source/types/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@
1414
*/
1515

1616
/* istanbul ignore file */
17+
18+
export * from './user';

source/types/user.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* *** MIT LICENSE ***
3+
* -------------------------------------------------------------------------
4+
* This code may be modified and distributed under the MIT license.
5+
* See the LICENSE file for details.
6+
* -------------------------------------------------------------------------
7+
*
8+
* @summary Collection of user related types
9+
*
10+
* @author Alvis HT Tang <alvis@hilbert.space>
11+
* @license MIT
12+
* @copyright Copyright (c) 2021 - All Rights Reserved.
13+
* -------------------------------------------------------------------------
14+
*/
15+
16+
interface UserBase<T extends string> {
17+
object: 'user';
18+
id: string;
19+
type: T;
20+
name: string;
21+
avatar_url?: string;
22+
}
23+
24+
export interface PersonUser extends UserBase<'person'> {
25+
person?: {
26+
email: string;
27+
};
28+
}
29+
30+
export type BotUser = UserBase<'bot'>;
31+
32+
export type User = PersonUser | BotUser;

0 commit comments

Comments
 (0)