StateKey
与 TransferState
一起使用的类型安全的键名。
A type-safe key to use with TransferState
.
type StateKey<T> = string & {
__not_a_string: never;
};
说明
例如:
Example:
const COUNTER_KEY = makeStateKey<number>('counter');
let value = 10;
transferState.set(COUNTER_KEY, value);