Improve type definitions

This commit is contained in:
syuilo
2021-06-20 00:43:29 +09:00
parent ce12fc2b67
commit f894d978df
3 changed files with 73 additions and 20 deletions

View File

@@ -3,7 +3,10 @@ export type DateString = string;
type TODO = Record<string, any>;
export type User = {
// NOTE: 極力この型を使うのは避け、UserLite か UserDetailed か明示するように
export type User = UserLite | UserDetailed;
export type UserLite = {
id: ID;
username: string;
host: string | null;
@@ -17,6 +20,12 @@ export type User = {
}[];
};
export type UserDetailed = UserLite & {
isLocked: boolean;
pinnedNotes: Note[];
// TODO
};
export type UserGroup = TODO;
export type UserList = {
@@ -26,7 +35,7 @@ export type UserList = {
userIds: User['id'][];
};
export type MeDetailed = User & {
export type MeDetailed = UserDetailed & {
avatarId: DriveFile['id'];
bannerId: DriveFile['id'];
autoAcceptFollowed: boolean;
@@ -307,5 +316,10 @@ export type FollowRequest = {
followee: User;
};
export type Channel = {
id: ID;
// TODO
};
export type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+updatedAt' | '-updatedAt';
export type OriginType = 'combined' | 'local' | 'remote';