When a method on a durable object return a value of type unknown (or an object with a property of type unknown), calling that method on its stub gives a result of type never. Tested with latest wrangler 4.35.0 and 4.50.0.
export class ADurableObject extends DurableObject<Env> {
async aMethod(): Promise<unknown> // or Promise<{ a: number, b: unknown}>
{ ... }
}
export default {
async fetch(request: Request, env: Env) {
const res = await env.ADurableObject.getByName('test').aMethod();
// res is of type never
}
}