Liam
Liam
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Liam on 1/16/2024 in #questions
Run Both Node and Bun Apps In a Turborepo
Hello, I was wondering if it possible to run both bun and node apps within the same turbo repo. I tried following the following guide, but it leads to alot of weird issues, including one where bun seems to be trying to install weird dependencies from other packages the bun app does not rely on. Any idea how I can do this? Thanks! Guide: https://dev.to/0xahmad/running-both-nodejs-and-bun-apps-in-turborepo-33id
2 replies
TTCTheo's Typesafe Cult
Created by Liam on 12/21/2023 in #questions
Any idea if @vercel/kv supports piping?
Question is pretty much in title. Docs for the SDK are pretty poor sadly :/
4 replies
TTCTheo's Typesafe Cult
Created by Liam on 8/1/2023 in #questions
Type Errors When Using File Input w/ react-hook-form & shadcn/ui
Hello! I was wondering if anyone has an example of them using react-hook-form and shadcn/ui for a file upload. I have been attempting to add this to a <Form /> but I am running into various type errors. I made a issue which goes a little more into depth about the issues I am running into: https://github.com/shadcn-ui/ui/issues/1085 Thanks for the help!
2 replies
TTCTheo's Typesafe Cult
Created by Liam on 7/29/2023 in #questions
Question About Drizzle Composite Keys
I posted this over on the drizzle server and wanted to crosspost it here in case anyone can take a look at it. Thanks! https://discord.com/channels/1043890932593987624/1134887847271346186/1134887847271346186
2 replies
TTCTheo's Typesafe Cult
Created by Liam on 7/28/2023 in #questions
TS Allow Certain Response Bodies
Hello, I would like to add a type I can use on my applications for checking the type of responses based on a zod validator. I have wrote the following type:
import { z, type ZodType } from "zod";
import type { NextResponse } from "next/server";

const unauthedRes = new Response("Unauthorized", { status: 401 });
export type serverZodResponse<T extends ZodType<any, any, any>> = Promise<
undefined | NextResponse<z.infer<T>>
>;
import { z, type ZodType } from "zod";
import type { NextResponse } from "next/server";

const unauthedRes = new Response("Unauthorized", { status: 401 });
export type serverZodResponse<T extends ZodType<any, any, any>> = Promise<
undefined | NextResponse<z.infer<T>>
>;
I would like to add a Response with a body of Unauthorized and a status of 401 to the type inside the Promise. Is there anyway to do this? Thanks!
2 replies
TTCTheo's Typesafe Cult
Created by Liam on 7/27/2023 in #questions
Add Generic To Response in Next
Hi, I am trying to type my return with NextResponse.json() in a next js API route. Any idea how I can do this? Thanks!
7 replies
TTCTheo's Typesafe Cult
Created by Liam on 7/23/2023 in #questions
Config RSC on Edge
Hi, If I want to run RSC on edge do I need to put export const runtime = edge in the components too or just the page and then it will waterfall that down to the components? Thanks!
2 replies
TTCTheo's Typesafe Cult
Created by Liam on 7/5/2023 in #questions
Counting rows in Drizzle ORM
Hi, I was wondering what the best way to count rows in drizzle is. Thanks for the help!
6 replies
TTCTheo's Typesafe Cult
Created by Liam on 7/4/2023 in #questions
Drizzle Insert w/ Relation
Hi, What is the way of inserting a new record with a relationship in Drizzle. I understand that Prisma abstracts this away as if you are inserting everything as once but under the hood it breaks it up into multiple queries. Is there anything like this in drizzle?
6 replies
TTCTheo's Typesafe Cult
Created by Liam on 6/21/2023 in #questions
Zod array with valid values
How can I make a zod array with certain valid values. I know I could do this with refine, but generally try to avoid that if possible to get better types. Thanks!
5 replies
TTCTheo's Typesafe Cult
Created by Liam on 6/16/2023 in #questions
In a turborepo, does the .vercel folder go at the root or inside of the app?
I am trying to run vercel link and then do a env pull. Thanks for the help!
2 replies
TTCTheo's Typesafe Cult
Created by Liam on 6/15/2023 in #questions
Setting Custom Error Messages on Zod Unions
Hello, I'd like to set a custom error message when a union of literals does not pass parsing in zod. With other constraints, such as .min() or .max() you can set a error message like this:
email: z
.string()
.email({ message: "Email must be a valid email (eg: [email protected]).",})
.max(255, { message: "Email must be less than 255 characters." }),
email: z
.string()
.email({ message: "Email must be a valid email (eg: [email protected]).",})
.max(255, { message: "Email must be less than 255 characters." }),
But I am not sure how to do so on this union:
gender: z.union([
z.literal("MALE"),
z.literal("FEMALE"),
z.literal("NON-BINARY"),
z.literal("OTHER"),
z.literal("PREFERNOTSAY"),
]),
gender: z.union([
z.literal("MALE"),
z.literal("FEMALE"),
z.literal("NON-BINARY"),
z.literal("OTHER"),
z.literal("PREFERNOTSAY"),
]),
Could anyone help me out? Thanks!
3 replies
TTCTheo's Typesafe Cult
Created by Liam on 6/12/2023 in #questions
Unique Constraint in Drizzle
Coming from Prisma, I am trying to have a unique constraint on a column. Anyone know how to do this? It says it is yet to be implemented in the docs, but I honestly don't know how Drizzle would be a viable alternative to Prisma without being able to set things like unique columns in a table.
6 replies
TTCTheo's Typesafe Cult
Created by Liam on 6/9/2023 in #questions
Is there a way with app dir layouts to do something like "island" based pages?
I am making a dashboard where various sections are shown depending on the url. Is there a way I can maintain the wrapper around the "page" without it completely reloading?
7 replies
TTCTheo's Typesafe Cult
Created by Liam on 6/7/2023 in #questions
Do server actions run on edge?
Thinking about using them in a project but am trying to strictly use edge. Anyone know if they run at edge?
10 replies
TTCTheo's Typesafe Cult
Created by Liam on 6/1/2023 in #questions
Auth.js Muti-device Support
I'm implementing auth right now in a site that the user will likely be switching from mobile to desktop with frequently. I wanted to make sure that just because they do this their JWT is not going to just expire and force them to log back in when they swap devices. Thanks!
11 replies
TTCTheo's Typesafe Cult
Created by Liam on 5/29/2023 in #questions
T3 Env Not Showing Type Errors
4 replies
TTCTheo's Typesafe Cult
Created by Liam on 5/27/2023 in #questions
Refresh a RSC
Hello, Is there a way to have a server component refresh itself programmatically? Essentially I have a server action that runs and then I want to have a specific server component rerender. Thanks!
10 replies
TTCTheo's Typesafe Cult
Created by Liam on 5/18/2023 in #questions
Moving Prisma Schema To Its Own Package in a Turborepo
Hello! I would like to move my prisma schema into its own package within a monorepo using turborepo. I have the monorepo up and running already, but was wondering if it is as simple as moving the prisma folder into the packages directory or if there is something else I have to do. Thanks!
5 replies
TTCTheo's Typesafe Cult
Created by Liam on 5/7/2023 in #questions
How does turborepo handle node_modules packages?
Hello, I want to add a new next app to my turborepo monorepo. If I am installing a new package in one of those apps, would I install it in the root directory of the turborepo or within that specific app. Additionally if I am using ct3a, do I need to move the dependencies from package.json into the one at the root directory? Thanks!
7 replies