Open slhck opened 2 years ago
Kinda sidestepping your question.. but you may want to look at leveraging https://www.npmjs.com/package/noice-json-rpc
I only found it recently but a few excellent tools use it. And the expression of CDP in the API is quite attractive.
Edit: Oh, you already found it. :)
Yes, I did! :)
I actually also found https://github.com/cyrus-and/chrome-remote-interface which is actively maintained and provides a similarly expressive API.
I also found that the file node_modules/devtools-protocol/types/protocol-proxy-api.d.ts
does contain the individual methods, albeit in a slightly different manner.
Feel free to close this issue if it's not worth implementing this.
While I can use TypeScript to type-check method parameters and response objects, I cannot actually ensure that the method I am calling exists, let alone that the parameters and response match what I am trying to call.
Consider this (simplified) function:
I can invoke it with
But I could easily pass
Runtime.foo
instead ofRuntime.evaluate
and it'd still pass.What I think would be required is: