From bab1dc1d97222c1f388a46fc34a9b89997ec0552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Fri, 1 Feb 2019 21:08:58 +0900 Subject: [PATCH] Create type definition for 'koa-json-body' (#4056) * Create type definition for 'koa-json-body' * Follow lint --- src/@types/koa-json-body.d.ts | 15 +++++++++++++++ src/server/activitypub.ts | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/@types/koa-json-body.d.ts diff --git a/src/@types/koa-json-body.d.ts b/src/@types/koa-json-body.d.ts new file mode 100644 index 000000000..5aa8179c5 --- /dev/null +++ b/src/@types/koa-json-body.d.ts @@ -0,0 +1,15 @@ +declare module 'koa-json-body' { + import { Middleware } from 'koa'; + + interface IKoaJsonBodyOptions { + strict: boolean; + limit: string; + fallback: boolean; + } + + function koaJsonBody(opt?: IKoaJsonBodyOptions): Middleware; + + namespace koaJsonBody {} // Hack + + export = koaJsonBody; +} diff --git a/src/server/activitypub.ts b/src/server/activitypub.ts index 20a8ee979..0c0ae6c52 100644 --- a/src/server/activitypub.ts +++ b/src/server/activitypub.ts @@ -1,6 +1,6 @@ import { ObjectID } from 'mongodb'; import * as Router from 'koa-router'; -const json = require('koa-json-body'); +import * as json from 'koa-json-body'; import * as httpSignature from 'http-signature'; import { createHttpJob } from '../queue';