chore(client): add type check
This commit is contained in:
parent
4ad399c593
commit
af1c9251fc
1 changed files with 5 additions and 1 deletions
|
@ -27,7 +27,11 @@ export function createAiScriptEnv(opts) {
|
||||||
return confirm.canceled ? values.FALSE : values.TRUE;
|
return confirm.canceled ? values.FALSE : values.TRUE;
|
||||||
}),
|
}),
|
||||||
'Mk:api': values.FN_NATIVE(async ([ep, param, token]) => {
|
'Mk:api': values.FN_NATIVE(async ([ep, param, token]) => {
|
||||||
if (token) utils.assertString(token);
|
if (token) {
|
||||||
|
utils.assertString(token);
|
||||||
|
// バグがあればundefinedもあり得るため念のため
|
||||||
|
if (typeof token.value !== 'string') throw new Error('invalid token');
|
||||||
|
}
|
||||||
apiRequests++;
|
apiRequests++;
|
||||||
if (apiRequests > 16) return values.NULL;
|
if (apiRequests > 16) return values.NULL;
|
||||||
const res = await os.api(ep.value, utils.valToJs(param), token ? token.value : (opts.token ?? null));
|
const res = await os.api(ep.value, utils.valToJs(param), token ? token.value : (opts.token ?? null));
|
||||||
|
|
Loading…
Reference in a new issue