diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-04-17 20:58:37 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2022-04-17 20:58:37 +0900 |
| commit | 31e5c5f69a565b6aaef3f79bcba4bf5e2beee170 (patch) | |
| tree | 92289adccd9b426c05d237c9be2d9da03acfe4ab /packages/backend/src/misc | |
| parent | refactor (diff) | |
| download | misskey-31e5c5f69a565b6aaef3f79bcba4bf5e2beee170.tar.gz misskey-31e5c5f69a565b6aaef3f79bcba4bf5e2beee170.tar.bz2 misskey-31e5c5f69a565b6aaef3f79bcba4bf5e2beee170.zip | |
refactor
Resolve #8467
Diffstat (limited to 'packages/backend/src/misc')
| -rw-r--r-- | packages/backend/src/misc/cafy-id.ts | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/packages/backend/src/misc/cafy-id.ts b/packages/backend/src/misc/cafy-id.ts deleted file mode 100644 index dd81c5c4cf..0000000000 --- a/packages/backend/src/misc/cafy-id.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Context } from 'cafy'; - -// eslint-disable-next-line @typescript-eslint/ban-types -export class ID<Maybe = string> extends Context<string | (Maybe extends {} ? string : Maybe)> { - public readonly name = 'ID'; - - constructor(optional = false, nullable = false) { - super(optional, nullable); - - this.push((v: any) => { - if (typeof v !== 'string') { - return new Error('must-be-an-id'); - } - return true; - }); - } - - public getType() { - return super.getType('String'); - } - - public makeOptional(): ID<undefined> { - return new ID(true, false); - } - - public makeNullable(): ID<null> { - return new ID(false, true); - } - - public makeOptionalNullable(): ID<undefined | null> { - return new ID(true, true); - } -} |