我想获得存储值,如果它不存在,请给我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)
你必须以某种方式表达lastDeposit
永远不允许是null
这是为我编译的错误
const lastDeposit: u64 = storage.getSome<u64>('lastDeposit') || 0;