-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #236 from nekochans/feature/upgrade-lgtm-cat-ui-
@nekochans/lgtm-cat-ui のバージョンを最新安定版の v2.2.7 にアップグレード
- Loading branch information
Showing
3 changed files
with
47 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,38 @@ | ||
import { | ||
createSuccessResult as orgCreateSuccessResult, | ||
createFailureResult as orgCreateFailureResult, | ||
isSuccessResult as orgIsSuccessResult, | ||
isFailureResult as orgIsFailureResult, | ||
Result as OrgResult, | ||
} from '@nekochans/lgtm-cat-ui'; | ||
export const SuccessMarker = 'SuccessMarker'; | ||
export const FailureMarker = 'FailureMarker'; | ||
|
||
export type Result<T, E> = OrgResult<T, E>; | ||
export type SuccessResult<T> = { value: T; _: typeof SuccessMarker }; | ||
export type FailureResult<E> = { value: E; _: typeof FailureMarker }; | ||
export type Result<T, E> = SuccessResult<T> | FailureResult<E>; | ||
|
||
export const createSuccessResult = orgCreateSuccessResult; | ||
export const createSuccessResult = <T>(value: T): SuccessResult<T> => ({ | ||
value, | ||
// eslint-disable-next-line id-length | ||
_: SuccessMarker, | ||
}); | ||
|
||
export const createFailureResult = orgCreateFailureResult; | ||
export const createFailureResult = <E>(value: E): FailureResult<E> => ({ | ||
value, | ||
// eslint-disable-next-line id-length | ||
_: FailureMarker, | ||
}); | ||
|
||
export const isSuccessResult = orgIsSuccessResult; | ||
export const isSuccessResult = <T>( | ||
result: Result<unknown, unknown> | ||
): result is SuccessResult<T> => { | ||
if ('_' in result) { | ||
return result._ === SuccessMarker; | ||
} | ||
|
||
export const isFailureResult = orgIsFailureResult; | ||
return false; | ||
}; | ||
|
||
export const isFailureResult = <T>( | ||
result: Result<unknown, unknown> | ||
): result is FailureResult<T> => { | ||
if ('_' in result) { | ||
return result._ === FailureMarker; | ||
} | ||
|
||
return false; | ||
}; |
38c9b58
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
lgtm-cat-frontend – ./
lgtm-cat-frontend-git-main-nekochans.vercel.app
lgtm-cat-frontend-nekochans.vercel.app
lgtm-cat-frontend.vercel.app
lgtmeow.com