typescript durable objects transaction api
# workers-help
t
Is there an example of how to type durable objects in the storage api?
Copy code
ts
state: DurableObjectState;
webSockets: Set<WebSocket>;
storage: DurableObjectStorage;
constructor(state: DurableObjectState, env: Env) {
  this.state = state;
  this.storage = state.storage;
  this.webSockets = new Set();
}
I guess I'd want to define the type of stuff accessed through this.storage.get()/set()
k
The methods are generic so you'd just do
this.storage.get<T>(key, opts)
, etc