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.

Client does not enforce 'no input' when an endpoint declared without 'input'

See original GitHub issue

Example

const appRouter = trpc .router() .query('getData', { async resolve() { return data; }, })

await api.query('getData', 'some unneeded input');

Runtime error - ‘no input expected’.

Expected Behaviour: Client should enforce no input on using the compiler.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
danielyogelcommented, Jul 21, 2021

They both have strict: true Actually, I’ve just verified this problem reproduces in tRPC’s original ‘standalone-server’ example:

Screen Shot 2021-07-21 at 17 50 58 Screen Shot 2021-07-21 at 17 55 34

VSCode’s TS version is 4.3.5

1reaction
KATTcommented, Jul 21, 2021

Ohhh — you’re right.

Try changing this line in the tests though to await client.query('q', 'something'); and you’ll get error correctly.

https://github.com/trpc/trpc/blob/d903a65f4506fb1f74bd6dc9f0e185fa94438b2c/packages/server/test/index.test.tsx#L172

Your guess is as good as mine, I tried throwing some tsconfig settings around but haven’t hit the nail yet!

Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL schema basics - Apollo GraphQL Docs
Your GraphQL server uses a schema to describe the shape of your available data. This schema defines a hierarchy of types with fields...
Read more >
Bindings for Durable Functions - Azure | Microsoft Learn
The orchestration trigger binding supports both inputs and outputs. Here are some things to know about input and output handling: inputs - ...
Read more >
Mutations and Input Types - GraphQL
Input types can't have fields that are other objects, only basic scalar types, list types, and other input types.
Read more >
Writing REST Services with RESTEasy Reactive - Quarkus
Declaring endpoints : URI mapping. Any class annotated with a @Path annotation can have its methods exposed as REST endpoints, provided they ...
Read more >
aws-cdk/aws-apigateway module - AWS Documentation
The StepFunctionsRestApi construct makes this easy by setting up input, output and error mapping. The construct sets up an API endpoint and maps...
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