【发布时间】:2021-12-01 00:28:35
【问题描述】:
我想获取存储值,如果不存在,请给我0
const lastDeposit = storage.get<u64>('lastDeposit', u64(0)) || u64(0);
但是编译器抛出
ERROR AS204: Type 'u64' cannot be nullable.
static get<T>(key: string, defaultValue: T | null = null): T | null {
~
in ~lib/near-sdk-core/storage.ts(178,44)
ERROR AS204: Type 'u64' cannot be nullable.
static get<T>(key: string, defaultValue: T | null = null): T | null {
~
in ~lib/near-sdk-core/storage.ts(178,62)
【问题讨论】:
标签: nearprotocol