cloudflare / cloudflare/workerd
passing `unknown` type via an RPC method results in return type resolving to `never`
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
### What versions & operating system are you using?
Wranlger 4.27.0
### Please provide a link to a minimal reproduction
https://github.com/repository/workers-never-type-repro
### Describe the Bug
The same also happens with `Fetcher`
```ts
import { WorkerEntrypoint } from "cloudflare:workers";
interface NestedUnknown {
bar: unknown[];
}
class Foo extends WorkerEntrypoint {
public wtf(): unknown {
return;
}
wtf2(): NestedUnknown {
return { bar: [] };
}
}
type TestService = Service;
export default {
async fetch(request, env, ctx): Promise {
const testService = {} as TestService;
// VV this is never type for some reason
const blah = await testService.wtf();
// also this is never type
const nested = await testService.wtf2();
return new Response("Hello World!");
},
} satisfies ExportedHandler;
```
### Please provide any relevant error logs
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.