You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.
importtype{appRouter}from'./server';import{createClient}from'@trpc/client';constclient=createClient<typeofappRouter>();asyncfunctionmain(){// you can CMD+click `postById` here and jump straight into your backendconstbyId1=awaitclient.queries.postById({input: {id: '1'}});// with meta data:constbyId2=awaitclient.queries.postById({input: {id: '2'},context: {batch: false,}});// For backwards compatability:constlist=awaitclient.query('postList');}
The reasoning with input: {} as an options object is that sometimes we might want to pass additional configuration and when input is optional it's a bit iffy to do client.query(undefined, {context: {foo: 'bar'}}
The text was updated successfully, but these errors were encountered:
The raw client API
The API you'd use if you are writing like a CLI or something with tRPC.
Client API Proposal with
Proxy
:Proxy
to the rescue!The reasoning with
input: {}
as an options object is that sometimes we might want to pass additional configuration and when input is optional it's a bit iffy to doclient.query(undefined, {context: {foo: 'bar'}}
The text was updated successfully, but these errors were encountered: