Client does not enforce 'no input' when an endpoint declared without 'input'
See original GitHub issueExample
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:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
They both have
strict: true
Actually, I’ve just verified this problem reproduces in tRPC’s original ‘standalone-server’ example:VSCode’s TS version is 4.3.5
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!