作为保留关键字的字段名如何能够“转义”以用于类型?
type User = {
type: Text; // `type` cant be used since its reserved
};我希望能够返回字段名为type的数据。
是否有字符前缀或其他东西,以便在请求中序列化时,它会输出“type”?
或者为字段指定“type”的某种序列化装饰。
发布于 2022-02-26 15:52:24
来自文档:If the field name is a reserved name in Motoko, an undescore is appended. So record { if : bool } corresponds to { if_ : Bool }.
https://stackoverflow.com/questions/71278020
复制相似问题