Skip to content

Commit

Permalink
型定義をよりコンパクトに
Browse files Browse the repository at this point in the history
  • Loading branch information
imoken777 committed May 11, 2024
1 parent d79ffb6 commit 97ad6b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iniad-api-client",
"version": "0.0.6",
"version": "0.0.7",
"description": "iniad-api-client is an unofficial client for INIAD API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
37 changes: 13 additions & 24 deletions src/types/public/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
export interface StatusInfo {
export type StatusInfo = {
readonly status: 'success' | 'error' | 'dummy';
readonly description: string;
}
};

export type LockerInfo = StatusInfo & {
readonly lockerAddress: string | null;
readonly lockerFloor: number | null;
};

export type ICCardInfo<IncludeStatusInfo = true> = IncludeStatusInfo extends true
? StatusInfo & {
readonly cardIDm: string | null;
readonly icCardComment: string | null;
}
: {
readonly cardIDm: string | null;
readonly icCardComment: string | null;
};
export type ICCardInfo = StatusInfo & {
readonly cardIDm: string | null;
readonly icCardComment: string | null;
};

export type AllICCardInfo = StatusInfo & {
readonly cards: ICCardInfo<false>[];
readonly cards: Omit<ICCardInfo, keyof StatusInfo>[];
};

export type RoomStatus = StatusInfo & {
Expand All @@ -29,20 +24,14 @@ export type RoomStatus = StatusInfo & {
readonly airPressure: number | null;
};

export type CardSignageLink<IncludeStatusInfo = true> = IncludeStatusInfo extends true
? StatusInfo & {
readonly cardIDm: string | null;
readonly url: string | null;
readonly displaySeconds: number | null;
}
: {
readonly cardIDm: string | null;
readonly url: string | null;
readonly displaySeconds: number | null;
};
export type CardSignageLink = StatusInfo & {
readonly cardIDm: string | null;
readonly url: string | null;
readonly displaySeconds: number | null;
};

export type AllCardSignageLinks = StatusInfo & {
readonly links: CardSignageLink<false>[];
readonly links: Omit<CardSignageLink, keyof StatusInfo>[];
};

export type DeleteCardSignageLink = StatusInfo & {
Expand Down

0 comments on commit 97ad6b6

Please sign in to comment.