From c4f74913225cc92d4285b6da0182b0daf62ca404 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Mon, 4 Feb 2019 01:30:33 +0900 Subject: Revert "Create new type definition for 'is-url' (#4013)" This reverts commit 014b58cb4098c31c1d0d8d2ad521e48368491d07. --- src/@types/is-url.d.ts | 7 ------- src/config/load.ts | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 src/@types/is-url.d.ts (limited to 'src') diff --git a/src/@types/is-url.d.ts b/src/@types/is-url.d.ts deleted file mode 100644 index c1ccadd498..0000000000 --- a/src/@types/is-url.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module 'is-url' { - function isUrl(string: string): boolean; - - namespace isUrl {} // Hack - - export = isUrl; -} diff --git a/src/config/load.ts b/src/config/load.ts index 57cfb8075c..ba8b4af3ce 100644 --- a/src/config/load.ts +++ b/src/config/load.ts @@ -6,7 +6,7 @@ import * as fs from 'fs'; import { URL } from 'url'; import * as yaml from 'js-yaml'; import { Source, Mixin } from './types'; -import * as isUrl from 'is-url'; +import isUrl = require('is-url'); import * as pkg from '../../package.json'; /** -- cgit v1.2.3-freya From 5891135ac17aa94bd9c20bf84d5afc1b6290fbec Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Mon, 4 Feb 2019 01:46:59 +0900 Subject: Create type definition for ./locales (#4117) --- locales/index.d.ts | 5 +++++ src/server/web/docs.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 locales/index.d.ts (limited to 'src') diff --git a/locales/index.d.ts b/locales/index.d.ts new file mode 100644 index 0000000000..4a9672c63f --- /dev/null +++ b/locales/index.d.ts @@ -0,0 +1,5 @@ +type Locale = { [key: string]: string }; + +declare const locales: { [lang: string]: Locale }; + +export default locales; diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index f823c308c2..1455abae78 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -16,7 +16,7 @@ import config from '../../config'; import { licenseHtml } from '../../misc/license'; const constants = require('../../const.json'); import endpoints from '../api/endpoints'; -const locales = require('../../../locales'); +import locales from '../../../locales'; import * as nestedProperty from 'nested-property'; function getLang(lang: string): string { -- cgit v1.2.3-freya From 99d8d0a484eca8901ea6f1d556d51411ddfd9209 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Mon, 4 Feb 2019 01:47:12 +0900 Subject: Create type definition for '*/const.json' (#4118) --- src/@types/const.json.d.ts | 3 +++ src/server/web/docs.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 src/@types/const.json.d.ts (limited to 'src') diff --git a/src/@types/const.json.d.ts b/src/@types/const.json.d.ts new file mode 100644 index 0000000000..40a96f2a2a --- /dev/null +++ b/src/@types/const.json.d.ts @@ -0,0 +1,3 @@ +declare module '*/const.json' { + const copyright: string; +} diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index 1455abae78..0597f50a9c 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -14,7 +14,7 @@ import * as glob from 'glob'; import * as yaml from 'js-yaml'; import config from '../../config'; import { licenseHtml } from '../../misc/license'; -const constants = require('../../const.json'); +import { copyright } from '../../const.json'; import endpoints from '../api/endpoints'; import locales from '../../../locales'; import * as nestedProperty from 'nested-property'; @@ -59,7 +59,7 @@ async function genVars(lang: string): Promise<{ [key: string]: any }> { vars['config'] = config; - vars['copyright'] = constants.copyright; + vars['copyright'] = copyright; vars['license'] = licenseHtml; -- cgit v1.2.3-freya