Closed janedegtiareva closed 5 years ago
It would be good to know what the error message is.
ERROR TS2531: Object is possibly 'null'.
return storage.get
in assembly/main.ts(938,9)
ERROR TS2531: Object is possibly 'null'.
encoder.setString(name, value);
in ~lib/nearEntry.ts(53,28)
Note that adding ! still results in a compile error: ERROR TS2531: Object is possibly 'null'.
encoder.setString(name, value);
~~~~~
in ~lib/nearEntry.ts(53,28)
fixed! Thank you!
//@nearfile import { near, context, storage, logging, base58, base64, PersistentMap, PersistentVector, PersistentDeque, PersistentTopN, ContractPromise, math } from "near-runtime-ts"; import { u128 } from "bignum";
export function setKeyValue(key: string, value: string): void { storage.set(key, value);
}
export function getValueByKey(key: string): string { return storage.get(key);
}
export function setValue(value: string): string { storage.set("name", value);
return value;
}
export function getValue(): string | null { return storage.get("name");
}