小编Kri*_*lay的帖子

如何在discord bot中制作多语言?

我有 en.json 和 ru.json 文件,我在那里按类型使用变量:

levelupmessage: "Congratulations on the new $ {level}"
Run Code Online (Sandbox Code Playgroud)

因为在 json 中你不能放入 `` 需要做什么才能不只是一个字符串?

javascript json node.js

4
推荐指数
1
解决办法
6880
查看次数

TS7053:元素隐式具有“任何”类型,因为“字符串”类型的表达式不能用于索引“User_Economy”类型

我花了大部分时间在这个问题上,但没有答案

错误: TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'User_Economy'.   No index signature with a parameter of type 'string' was found on type 'User_Economy'.


    interface User_Economy {
        rep: number
        money: number
        level: number
        xp: number
        box: number[]
    }
    interface User_Interface{
        Economy: User_Economy
    }
    data = await this.client.db.insert_one<User_Interface>('users', User_basic(member.id, message.guild.id));
    const type: keyof {[key: string]: User_Economy} = ['level', 'money', 'rep', 'xp'].find(x => {
                return typed.toLowerCase() === x ? x : …
Run Code Online (Sandbox Code Playgroud)

javascript types object node.js typescript

1
推荐指数
1
解决办法
1165
查看次数

标签 统计

javascript ×2

node.js ×2

json ×1

object ×1

types ×1

typescript ×1