refactor: fix type

This commit is contained in:
syuilo 2022-04-17 13:21:07 +09:00
parent 3770bb6576
commit 1ee757cc5f
1 changed files with 10 additions and 5 deletions

View File

@ -1,12 +1,12 @@
import define from '../../define.js';
import { getNote } from '../../common/getters.js';
import { ApiError } from '../../error.js';
import { URLSearchParams } from 'node:url';
import fetch from 'node-fetch';
import config from '@/config/index.js';
import { getAgentByUrl } from '@/misc/fetch.js';
import { URLSearchParams } from 'node:url';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { Notes } from '@/models/index.js';
import { ApiError } from '../../error.js';
import { getNote } from '../../common/getters.js';
import define from '../../define.js';
export const meta = {
tags: ['notes'],
@ -80,7 +80,12 @@ export default define(meta, paramDef, async (ps, user) => {
agent: getAgentByUrl,
});
const json = await res.json();
const json = (await res.json()) as {
translations: {
detected_source_language: string;
text: string;
}[];
};
return {
sourceLang: json.translations[0].detected_source_language,