Context
Context<
CustomContext
,NetlifySDKContext
>:TRPCNetlifyContext
&NetlifySDKContext
&CustomContext
Context
is an extended version of tRPC’s built-in Context object that includes Netlify
SDK-specific extensions.
You can consume this type when you initialize tRPC.
Type Parameters
Type Parameter | Default type |
---|---|
CustomContext | Record <string , unknown > |
NetlifySDKContext extends NetlifySDKContext | NetlifySDKContext |
Example
import { type Context as BaseContext } from "@netlify/sdk/ui/functions/trpc";
type MyExtensionCustomContext = { // ...};
export type Context = Context<MyExtensionCustomContext>;
const trpc = initTRPC.context<Context>().create();