From 84d0ad12d145238370628d73dadb640c74f61637 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 10 Aug 2017 22:06:47 +0900 Subject: Fix typescript --- src/api/server.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/api/server.ts') diff --git a/src/api/server.ts b/src/api/server.ts index 0e059f5d2e..c98167eb3e 100644 --- a/src/api/server.ts +++ b/src/api/server.ts @@ -45,7 +45,9 @@ app.post('/signup', require('./private/signup').default); app.post('/signin', require('./private/signin').default); app.use((req, res, next) => { - res.locals.user = ((req.headers['cookie'] || '').match(/i=(!\w+)/) || [null, null])[1]; + // req.headers['cookie'] は常に string ですが、型定義の都合上 + // string | string[] になっているので string を明示しています + res.locals.user = ((req.headers['cookie'] as string || '').match(/i=(!\w+)/) || [null, null])[1]; next(); }); -- cgit v1.2.3-freya