From f893fd3a3fdc516710ba9973fd6a97d3b6408efe Mon Sep 17 00:00:00 2001 From: takejohn <105504345+takejohn@users.noreply.github.com> Date: Sun, 24 Mar 2024 19:07:03 +0900 Subject: [PATCH] =?UTF-8?q?config.ts=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E5=AF=BE=E5=87=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config.ts b/src/config.ts index 9466b0c..aac43af 100644 --- a/src/config.ts +++ b/src/config.ts @@ -17,9 +17,16 @@ type Config = { memoryDir?: string; }; -import config from '../config.json' assert { type: 'json' }; +import uncheckedConfig from '../config.json' assert { type: 'json' }; + +function validate(config: unknown): Config { + // TODO: as を使わずにしっかりと検証を行う + return config as Config; +} + +const config = validate(uncheckedConfig); config.wsUrl = config.host.replace('http', 'ws'); config.apiUrl = config.host + '/api'; -export default config as Config; +export default config;