oscartbeaumont / rspc

A framework for building typesafe web backends in Rust
https://rspc.dev
MIT License
1.1k stars 50 forks source link

Vanilla-Client: Websocket subscriptions input types are wrongly infered #227

Open v-morlock opened 9 months ago

v-morlock commented 9 months ago

Hi,

When i defined subscriptions as follows,

        .subscription("...", |t| {
            t(move |_, _: ()| {
                async_stream::stream! {
...
                }
            })
        })

the generated bindings.ts looks like that:

  subscriptions:
    | { key: "on_document"; input: never; result: DocumentResult };

However, Typescript wants me to pass [] as an argument when starting the subscription using the vanilla client, which fails. When passing undefined, everything works, however typescript resports an error.