New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpc can only return type
not interface
/class
#2003
Comments
type
not interface
type
not interface
/class
Just ran into it not working with |
As discussed, it's expected (and documented) that class instances are only supported if they extend That said, it sounds like there is arguably a bug in the TypeScript types. It sounds like the types treat @mrbbot Is there any way for us to more specifically filter out class instances using the TypeScript type system? |
Err, apparently @mrbbot recently left the company. Sorry for the spurious ping @mrbbot, hope things go well at whatever's next for you. I'm not sure who that leaves as the typescript wizard now. @GregBrimble any thoughts? |
Recursively mapping the return type to a type alias helped me work around this issue with some 3rd party types type InterfaceToType<T> = T extends object ? { [P in keyof T]: InterfaceToType<T[P]> } : T
class Foo extends RpcTarget {
async bar(): Promise<InterfaceToType<InterfaceOfThirdParty>> {
// ...
}
} |
@penalosa would be my next go-to! |
Repro
When calling a DO RPC method, return type collapses to
Promise<undefined>
/never
if using aninterface
. When using atype
, return values are as expected.The text was updated successfully, but these errors were encountered: