Skip to content

Commit

Permalink
Merge pull request #236 from nekochans/feature/upgrade-lgtm-cat-ui-
Browse files Browse the repository at this point in the history
@nekochans/lgtm-cat-ui のバージョンを最新安定版の v2.2.7 にアップグレード
  • Loading branch information
keitakn authored Dec 13, 2022
2 parents c064676 + 2394f84 commit 38c9b58
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 26 deletions.
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"chromatic": "chromatic --project-token=$CHROMATIC_PROJECT_TOKEN"
},
"dependencies": {
"@nekochans/lgtm-cat-ui": "^2.2.1",
"@nekochans/lgtm-cat-ui": "^2.2.7",
"@sentry/nextjs": "^7.23.0",
"lodash.throttle": "^4.1.1",
"next": "^13.0.6",
Expand Down
45 changes: 33 additions & 12 deletions src/features/result.ts
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;
};

1 comment on commit 38c9b58

@vercel
Copy link

@vercel vercel bot commented on 38c9b58 Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.