createKey
Creates a typed key for event.set / event.get.
Creates a typed key for event.set / event.get. Keys compare by identity, so two keys with the
same name are different keys.
Import#
ts
import { createKey } from "@shadow-js/dusk/server";
Signature#
ts
function createKey<T>(name: string): ContextKey<T>
Parameters#
| Name | Description |
|---|---|
name |
A name for diagnostics. |
Returns#
The key.
Examples#
ts
export const userKey = createKey<{ id: string }>("user");