Remove unneccesary casts
This commit is contained in:
parent
3a2dc95850
commit
0b6b6a4f2f
|
@ -30,7 +30,7 @@ async function genVars(lang: string): Promise<{ [key: string]: any }> {
|
||||||
|
|
||||||
const entities = glob.sync('src/docs/api/entities/**/*.yaml', { cwd });
|
const entities = glob.sync('src/docs/api/entities/**/*.yaml', { cwd });
|
||||||
vars['entities'] = entities.map(x => {
|
vars['entities'] = entities.map(x => {
|
||||||
const _x = yaml.safeLoad(fs.readFileSync(cwd + x, 'utf-8')) as any;
|
const _x = yaml.safeLoad(fs.readFileSync(cwd + x, 'utf-8'));
|
||||||
return _x.name;
|
return _x.name;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ router.get('/*/api/entities/*', async ctx => {
|
||||||
const lang = ctx.params[0];
|
const lang = ctx.params[0];
|
||||||
const entity = ctx.params[1];
|
const entity = ctx.params[1];
|
||||||
|
|
||||||
const x = yaml.safeLoad(fs.readFileSync(path.resolve(`${__dirname}/../../../src/docs/api/entities/${entity}.yaml`), 'utf-8')) as any;
|
const x = yaml.safeLoad(fs.readFileSync(path.resolve(`${__dirname}/../../../src/docs/api/entities/${entity}.yaml`), 'utf-8'));
|
||||||
|
|
||||||
await ctx.render('../../../../src/docs/api/entities/view', Object.assign(await genVars(lang), {
|
await ctx.render('../../../../src/docs/api/entities/view', Object.assign(await genVars(lang), {
|
||||||
id: `api/entities/${entity}`,
|
id: `api/entities/${entity}`,
|
||||||
|
|
Loading…
Reference in a new issue