question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSONRPCParams typing issue

See original GitHub issue

https://github.com/shogowada/json-rpc-2.0/blob/7bc786c03b47b1e0a93e1d8b9df2c6a2d42a4094/src/models.ts#L5

Should probably be:

export type JSONRPCParams = any | any[];

Or just:

export type JSONRPCParams = any;

Or you will get errors from TypeScript while trying to destructure params or to type it as object is akin to {}, an object with no known props.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
shogowadacommented, Nov 19, 2022

Adding "strictFunctionTypes": true to tsconfig.json surfaces this error. In your example, "extends": "@tsconfig/node16/tsconfig.json" inherits this setting.

Let me think of something so that it works with strict mode! Thank you for reporting.

1reaction
segevfinercommented, Oct 30, 2022

Try this: https://github.com/segevfiner/json-rpc-2.0-types-issue, just a pnpm build should show the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON-RPC over HTTP
Since JSON-RPC uses JSON, it shares the same type system as JSON (see http://www.json.org or RFC 4627). Whenever this document refers to any...
Read more >
params field could be a restricted JSON schema instead of ...
To solve all these issues I would propose to replace the OpenRPC params field by a restricted JSON schema. Restricted means "limited to...
Read more >
JSON RPC API - Solana Docs
To make a JSON-RPC request, send an HTTP POST request with a Content-Type: application/json header. The JSON request data should contain 4 fields:...
Read more >
Processing JSON-RPC 2.0 request parameters
The new utility classes solve three common issues that occur when processing request parameters: Provide type correct retrieval of the JSON ...
Read more >
jsonrpc2 - Go Packages
JSON-RPC 2.0 support positional and named parameters. Which one should be used when calling server's method depends on type of that method's ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found