Will
Explore posts from serversTTCTheo's Typesafe Cult
•Created by Will on 9/23/2023 in #questions
What happens if I accidentally use `npm install` inside of a turborepo using `pnpm`?
Is it okay or do I need to undo something? Thanks!
3 replies
TTCTheo's Typesafe Cult
•Created by Will on 9/21/2023 in #questions
Experience nextjs dev going from web to mobile, what should I know?
Title says it all! I'm a fairly experience dev who has built a decent number of apps in nextjs (mostly using t3). I'm making the jump into some mobile dev. Any advice or tips? Looking specifically for insights coming from people who have made the jump in a similar way. Thanks!
2 replies
TTCTheo's Typesafe Cult
•Created by Will on 9/20/2023 in #questions
As a nextjs + shadcnui user going to expo + react native, what libraries should I know about?
My biggest concern jumping into react native is not having the libraries I know and love like tailwind and shadcnui. What are you guys using?
8 replies
DTDrizzle Team
•Created by Will on 9/8/2023 in #help
Prepared Statement - Neon Syntax Error
Hi there,
I am trying to use a prepared statement to run a query but am getting a syntax error. below you can see the .toSql() logged, as well as the error.
here is my prepared statement:
I don't see anything wrong with my prepared statement. Can anyone spot what I'm doing wrong or let me know if this is a bug? Much appreciated.
2 replies
DTDrizzle Team
•Created by Will on 9/4/2023 in #help
ERROR: prepared statement "s9656" does not exist
11 replies
DTDrizzle Team
•Created by Will on 8/29/2023 in #help
How to use a composite primary key in WHERE?
I have a table dv360UserProfilesTable which uses a composite key of userId and assignedUserProfileId. If I want to update this table, I'm struggling with how to use the composite key to batch update profiles. The below code throws the error: db error: ERROR: argument of WHERE must be type boolean, not type record
The docs also do not show an example of this https://orm.drizzle.team/docs/indexes-constraints#composite-primary-key
4 replies
DTDrizzle Team
•Created by Will on 8/18/2023 in #help
How would you write this REPLACE query?
I'm trying something like this:
but am getting this error: NeonDbError: db error: ERROR: argument of WHERE must be type boolean, not type record
I don't really understand why the where is not type boolean here because I'm using an IN statement.
3 replies
DTDrizzle Team
•Created by Will on 8/17/2023 in #help
Connecting to Neon through Drizzle via Cloud Function
Hi there! I have a nextjs app that is hooked up to neon via drizzle. I want to use some cloud functions to do some additional data transfer into the DB.
1. Does anyone have any advice on how to set up a cloud function with Drizzle?
2. How would you go about sharing the schema between the cloud function and the next app? I'm thinking I'll need to set up some sort of monorepo like turborepo but I don't know what the deal is with putting a google cloud function in a turborepo.
Thanks!
1 replies
DTDrizzle Team
•Created by Will on 8/3/2023 in #help
How do I import a type?
This might be something I'm just totally overlooking, but I'm used to prisma where you can just import any schema you've defined as a type.
For example, if I have a table
posts
, I'd expecect to be able to import a Post
type to be used in one of my child components.
Is this possible with Drizzle? Or have you all found it to be unnecessary14 replies
TTCTheo's Typesafe Cult
•Created by Will on 4/13/2023 in #questions
Prisma + Zod.. which types to use as SOT? Is there a better way?
I’m building t3 app with prisma. Since I want to use trpc and react hook form, i feel like i also need zod. But now I have a dilemma of needing to pick a source of truth for my types. I’m assuming I should use prisma since its ultimately the db. I’ve looked at some libraries to generate zod schemas from prisma, but it just doesn’t feel like the cleanest way to go about this. How have you all handled this in the past?
6 replies
TTCTheo's Typesafe Cult
•Created by Will on 4/8/2023 in #questions
What's everyone's favorite testing library for the T3 stack?
I'm trying to use cypress right now, but it's kind of a pain with the Discord auth. Does anyone have any other suggestions / tutorials I can look at to figure out how to get cypress set up with T3? I'm open to other testing libs too, I just want this to be easy lol
2 replies
TTCTheo's Typesafe Cult
•Created by Will on 2/23/2023 in #questions
Does anyone know of a way to programmatically lift classNames into typescript intellisense?
For example, if I import this component somewhere else, I'd like to be able to see the classNames that were applied to the div when I hover over <Example />
You are probably wondering why I would ever want to do that. It's because I wrote this l created this library http://chimera-ui.com/docs/components, where the components have default styles applied with Tailwind. When users import these components, I'd like to expose that styling to them via typescript intellisense.
82 replies
TTCTheo's Typesafe Cult
•Created by Will on 2/21/2023 in #questions
Can you critique my idea/methodology for a Tailwind UI lib + semantic color system combo?
I am still a pretty entry level dev (~2 years experience), and this is my first UI library. While I think this is a pretty good idea, I don't think I have the experience to be confident about it, so I am hoping you guys can point out some blind spots / pitfalls with this approach.
I've put up a docs site that goes into more detail https://www.chimera-ui.com/, but general idea is this:
- Put a thin wrapper around radix primitives with a layer of default styling, and then allow users to overwrite that styling with tailwind.
- Define a semantic color system and use that color system in the default styling
This means a lot of the predefined Tailwind styles are abstracted away. You could import this
Button
component and use without writing any classes,
but under the hood it actually has h-10 py-2 px-4 bg-primary....
applied. You can overwrite those styles by writing classes like you would anywhere else, because the components use tailwind-merge under the hood.
I think the advantages here are:
- You can import components that look great out of the box, but you still get to keep the tailwind flow going
- Cleaner JSX, since a lot of the styles are abstracted away. You also don't need to redefine the same basic styles all over the place.
- By using semantic color names, you don't have to re-style components when you re-use them in other projects. For example, if you have bg-blue-500
on a component, you might have to change it to bg-red-300
when you copy and paste it into another project. Across all of your components, it can be a pain. But if you just use bg-primary
, then you just need to change the theme or css variable in one place.
I've been keeping up with Theo's & the rest of Twitter's thoughts on TW. There's part of me that is worried that I am going against TW philosophy in a way, by abstracting some classes away. But then again, Daisy UI does that as well. What do you guys think? Thanks in advance!18 replies
TTCTheo's Typesafe Cult
•Created by Will on 2/20/2023 in #questions
Is it important to learn object oriented programming?
Little background - I've been programming for a little over 2 years now. I'm pretty comfortable building full stack apps, but most of my programming education has been around functional programming. I know the basics of OOP and have come across it from time to time, but have never found a use case/need.
I'm sure there are plenty of jobs out there that require it, but it feels to me like the world has been shifting towards functional programming. Maybe I'm biased because I hang out here. For those of you with more real-world experience than me, would you recommend I put in the effort to learn it? Or just stick with functional?
11 replies
TTCTheo's Typesafe Cult
•Created by Will on 1/26/2023 in #questions
Updates from mutation responses with trpc?
I'm trying to automatically update a list query after updating the list with a mutation. The tanstack query docs show its pretty easy to do with straight up tanstack query: https://tanstack.com/query/v4/docs/react/guides/updates-from-mutation-responses
However, with the t3 setup and trpc wrapper, I'm struggling to figure out how to do this.
If I try to add a querykey like
list: publicProcedure.query("items", async () => {
, I get an error saying that query()
is only expecting 1 argument, not 2.11 replies
TTCTheo's Typesafe Cult
•Created by Will on 1/25/2023 in #questions
How do you hit trpc endpoints via http request?
I am fairly new to trpc. It's awesome when consuming the API through the client. But what if I want to test the API via postman or make a get request using the browser?
For example, with a normal next api route, I could go to localhost:3000/api/hello and it would return the data. Can I do something similar with trpc endpoints?
I tried going to localhost:3000/api/trpc/example/hello but that did not work. Thanks in advance!
26 replies