• Robert Knight's avatar
    Add missing types for PortRPC method handlers · 9ea1e6d7
    Robert Knight authored
    Previously the arguments of the callback passed to `PortRPC.on` were
    inferred as `any`. Make the callback type generic so that the caller is
    forced to specify what types the arguments have.
    
    Internally within PortRPC, use `unknown` rather than `any` for RPC
    method arguments where possible.
    
    Note that this change does not ensure that an RPC method is called (via `call`)
    using arguments of the same types that the handler expects, but at least it is
    now easier to check that the `call` and `on` uses match up and that arguments
    are typed within the handler.
    9ea1e6d7
port-rpc.js 10.3 KB