config.tsのエラーに対処

This commit is contained in:
takejohn 2024-03-24 19:07:03 +09:00
parent 830c9c2ecd
commit f893fd3a3f

View file

@ -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;