From 23f58bb6a4a46a3b0713fe681e8aa1061fedec5c 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: Sun, 3 Feb 2019 22:21:47 +0900 Subject: [PATCH] Create new type definition for 'escape-regexp' (#4058) --- src/@types/escape-regexp.d.ts | 7 +++++++ src/server/api/endpoints/hashtags/search.ts | 2 +- src/server/api/endpoints/users/search.ts | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 src/@types/escape-regexp.d.ts diff --git a/src/@types/escape-regexp.d.ts b/src/@types/escape-regexp.d.ts new file mode 100644 index 000000000..d68e6048a --- /dev/null +++ b/src/@types/escape-regexp.d.ts @@ -0,0 +1,7 @@ +declare module 'escape-regexp' { + function escapeRegExp(str: string): string; + + namespace escapeRegExp {} // Hack + + export = escapeRegExp; +} diff --git a/src/server/api/endpoints/hashtags/search.ts b/src/server/api/endpoints/hashtags/search.ts index 4d753808d..d8a215635 100644 --- a/src/server/api/endpoints/hashtags/search.ts +++ b/src/server/api/endpoints/hashtags/search.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import Hashtag from '../../../../models/hashtag'; import define from '../../define'; -const escapeRegexp = require('escape-regexp'); +import * as escapeRegexp from 'escape-regexp'; export const meta = { desc: { diff --git a/src/server/api/endpoints/users/search.ts b/src/server/api/endpoints/users/search.ts index 86b16dcbb..b0a789c7d 100644 --- a/src/server/api/endpoints/users/search.ts +++ b/src/server/api/endpoints/users/search.ts @@ -1,5 +1,5 @@ import $ from 'cafy'; -const escapeRegexp = require('escape-regexp'); +import * as escapeRegexp from 'escape-regexp'; import User, { pack, validateUsername, IUser } from '../../../../models/user'; import define from '../../define';