Evan
Evan
TtRPC
Created by Evan on 9/4/2024 in #❓-help
Generating Types in v11
if you figure it out pls lmk!
6 replies
TtRPC
Created by Evan on 9/4/2024 in #❓-help
Generating Types in v11
I might be wrong, but I gave up and went with that solution for now
6 replies
TtRPC
Created by Evan on 9/4/2024 in #❓-help
Generating Types in v11
@divramod no, my understanding is that the monorepo model is required right now for v11. I am directly importing from the server, not creating a type
6 replies
TtRPC
Created by Evan on 9/3/2024 in #❓-help
TSC errors after upgrading to v11
fixed by adding the "DOM" lib to my TS config
6 replies
TtRPC
Created by Evan on 9/3/2024 in #❓-help
TSC errors after upgrading to v11
looking online it seems like this might be an issue with typescript and node/browser types? i'm on the latest TS
6 replies
TtRPC
Created by Evan on 9/3/2024 in #❓-help
TSC errors after upgrading to v11
Here is my server:

import { initTRPC } from "@trpc/server";
import type { CreateAWSLambdaContextOptions } from "@trpc/server/adapters/aws-lambda";
import { awsLambdaRequestHandler } from "@trpc/server/adapters/aws-lambda";
import type { APIGatewayProxyEvent } from "aws-lambda";

function createContext({
event,
}: CreateAWSLambdaContextOptions<APIGatewayProxyEvent>) {

return {
event: event,
apiVersion: (event as { version?: string }).version ?? "1.0",
user: event.headers["x-user"],
};
}
type Context = Awaited<ReturnType<typeof createContext>>;

const t = initTRPC.context<Context>().create();

const router = t.router;

const appRouter = router(...);

export type AppRouter = typeof appRouter;

export const handler = awsLambdaRequestHandler({
router: appRouter,
createContext,

});

import { initTRPC } from "@trpc/server";
import type { CreateAWSLambdaContextOptions } from "@trpc/server/adapters/aws-lambda";
import { awsLambdaRequestHandler } from "@trpc/server/adapters/aws-lambda";
import type { APIGatewayProxyEvent } from "aws-lambda";

function createContext({
event,
}: CreateAWSLambdaContextOptions<APIGatewayProxyEvent>) {

return {
event: event,
apiVersion: (event as { version?: string }).version ?? "1.0",
user: event.headers["x-user"],
};
}
type Context = Awaited<ReturnType<typeof createContext>>;

const t = initTRPC.context<Context>().create();

const router = t.router;

const appRouter = router(...);

export type AppRouter = typeof appRouter;

export const handler = awsLambdaRequestHandler({
router: appRouter,
createContext,

});
6 replies