(type: T)
| 47 | export const withActor = ActorContext.with; |
| 48 | |
| 49 | export function assertActor<T extends Actor["type"]>(type: T) { |
| 50 | const actor = useActor(); |
| 51 | if (actor.type !== type) { |
| 52 | throw new Error(`Expected actor type ${type}, got ${actor.type}`); |
| 53 | } |
| 54 | |
| 55 | return actor as Extract<Actor, { type: T }>; |
| 56 | } |
| 57 | |
| 58 | export function useWorkspace() { |
| 59 | const actor = useActor(); |
no outgoing calls
no test coverage detected