Theo's Typesafe Cult

TTC

Theo's Typesafe Cult

Join the community to ask questions about Theo's Typesafe Cult and get answers from other members.

Join

CVA Boolean type enables

I have a table cell component that I am working on, and im trying to do a couple of styles that can be triggered in a boolean type as they can be mixed with my main variants i basically want to add the styling of link when link: true is passed in as a prop ```ts...
Solution:
figured it out thanks to https://youtu.be/T-Zv73yZ_QI?t=475 code is ```ts const cell = cva('whitespace-nowrap px-3 py-4 text-sm font-normal',...

invalid environment variables

I logged all variables all of them are undefined, what might have gone wrong? ```js { DATABASE_URL: undefined, NEXTAUTH_SECRET: undefined,...

Problems with next-auth middleware

```ts import { withAuth } from 'next-auth/middleware'; const publicFileRegex = /.(.*)$/; const anonymousRoutes = ['/auth/signin']; // The whitelisted routes...

Create T3 app to PWA

Hi, has anyone managed to refactor create t3-app to PWA? I don't know how to do it. could someone share his next.config.mjs please? Thanks a lot

Need advice on SVGs for creating custom shapes for react/next

I'll be creating some custom shapes (e.g. custom maps, math/geometry illustrations) for a react app and i remember from somewhere that SVGs might be the best way to handle those. What would be a good way of going about this for someone new to SVGs in webdev? The current workflow i have in mind would be to learn figma (i already know photoshop so i guess the learning curve would be a bit less steep). Then use figma to create the shapes, export them for use in react?...

Stupid Prettier parsing, it adds two spaces triggering my ADHD error system

Kind of a stupid question but whenever I use an union in TS, Prettier lints it with two extra spaces, triggering a visual error on that line. What setting prevents that? Don’t you dare telling me stop using tabs and start using spaces though theowat
Solution:
if it triggers you that much just type // 😅...

Vercel deployment error

How can I solve this vercel deployment error for my t3 project? I haven't used vercel before. npm runing locally works well, but deploying on vercel gives me this strange error with no inormation

:x: tRPC failed on posts.create: Unauthorized -- from T3 Stack Tutorial tutorial

NOTICE: Unauthorized, not UNAUTHORIZED as thrown in enforceUserIsAuthed. Am confused as "Unauthorized" not found in files Followed most of the tutorial, then github. PrivateProcedure resolves as valid userID not null. also switched ssg for createServerSideHelpers()...

Question about Prisma Joins and Performance

I'm starting to stack multiple "joins" with prisma but am getting concerned with the approach. I read that joins in general may not be great for performance so that this could be a plus, but maybe I misread or am making that up. What is the consensus on Prisma's way of handling joins or the idea that raw query is not type safe? Is anyone regularly stacking joins with Prisma and have any pro tips? Example: ```javascript...

Change return type based on value of parameters

I'm trying to change the return type of a function based on the value of the arguments passed to the function itself. I'm struggling to find the right documentation for it, could anyone point me in the right direction Here's an example of what I want: ```...
Solution:
Here is the final solution in case anyone is curious https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgUygYwEwAYCCAhASQBo4BXAZ2TwEMAbagOzWRIuQGEIGYpq0YASsmoATVpU7de-IaPJwAvnABmUCCDgAiAO7UA5iGCaA3AFgAUBZgBPMMjg1KAUQHtsABWq8Q8gLyILODgYCABrZAYcEREoZHJyAC44AAMsAA8AEgRyHmAGPQVkwLg0AAtqPIIRJIZSEAAjVDNzIJBkGFFqDoB+JPqICFphBmagtihelPSsnKg8guTRlAZqeqGRSf7B4aXdGDLNgaHGJeowMDUAN2RD7ZPi8jsGEVRJ1Mzs3PzCuAAfMmeyGUeWQImaCmaVls9hw5yuyBcbiwnm85AAPAAVRz2ZBpGARETybGIjxeag+AB8cH8CAeTxeUCSWOolAA2pozhcINdNABdFB4gnyZR0Sh-AEvYEMUHi2q0WjFboSoEgkTFJLvGZfBanOHc5A4EAQUjcJnY9mc+F8gX457C0X2f4myWq2WkeWK5VS0HquD1YB6PIwJa4vgwWFcy50SbMtkcvU8-m422ElQO8XOlXSkRuj0tOBKzPetX5vpHHYWCEWCwAehrwWhcAAqs5XKTUdSHCyEW3kWSfHAAGRwCPwkl91Fo4m9lHk8gU5o2OzN1tI2cD-zTtf98iQ8xL+zjgCy7U6HU7tPzKzaSVm8yW5GsDUGt+1SxeaFAopqdUaUCWIQdLQADKpDnLQ1h9AGQbgnuB4rj2SJCOQ7rwDSxRtB0IhdNQkzHqe2EdEs9R0IwzCbNB3CwdW+6NuOyGoSeWE4Z27jAGgoRoi2iHYAxtAwCQmiYWe1CaAuULLvRcSoTQ9BMPY-hsRxXGrrx0n8YJJFycwYlwXRvZ8TAmLrvIyZCgh44mVS6H5sJhHUEyJnsnZOHWmZdpprQYpOoCxa5gq+ZKtK1xQL6+HMeePkutmxGkfJjk7uy4xuYKHkil5jpeq6-xygFQRBcgIW+v6gbcBmvmqqc8oQLo8VwBiTmaI8BKoClKb2hl5XRTKOXunlBZwMFqC+g1iWaMlSapam6XeVl2b+Z6Q2haWfqUfAUVZqC1GWOYuKQLAKgmvwwBcGQqlYMZO42uZ3GWTuFIABSXq0BEsf4PCkCwxTjJ2RaqkQxRlBUDBVAD+YhOEkTRLE8Rg0EESrOsnYfV9+bNYCUC-RV2Zw3AexlJ2M2o0Elr6oTDpgwoCTFKNqIAJRJFJKH8ZdqJUpeNE0UEsQwKQUAMAE+YvRFDmC0E4uDeSyBJAA5BicQwDLuMS4+z60LL8s5ErxQSx+X5eUkACMAAcyvi4BdCgeBkEOAGBDcA9htYFgdM64oZtaWR0u23o9swI7Ltm3QtA1V7SR4HbDtO3TuNKCycBM6hrNzuJ5gKDRaBcDkiBwC5HQkMHofySQnvyYov3nU9gPlJU1RwIbuMQxEUQxHEiRwDL6RYNrad03AdZwCIEBxAwMvwHkyioINhVTweGdZ-ASB56Ly8YAX1W1cwSSF5vyBr36cVbwf2l7+X-hsOOVf5kDtdG43YTN9Dbey13PdjJQjJzaClN9wPQ9xHACeU8loNjsBYIAA...

Thoughts on Codeium

Has anyone used Codeium? I read about it the other day in the TLDR newsletter and have been trying out. https://codeium.com/

Fresh CT3 app nextAuth error

Hello! Trying out CT3 for the first time, pretty exciting to finally have a project to try it on! Now i followed the first steps guide and setup discord as an auth provider, followed the steps to add the values to the .env file. Generated a secret using openssl rand -base64 32 and set it as the next auth secret. Now when trying to login i keep getting errors: ```[next-auth][error][JWT_SESSION_ERROR] https://next-auth.js.org/errors#jwt_session_error Cannot read properties of undefined (reading 'id') { message: "Cannot read properties of undefined (reading 'id')",...

Rendered more hooks than during the previous render.

const user = useUser();
const email = user.user?.emailAddresses?.[0]?.emailAddress;
const isAdmin = api.user.isAdmin.useQuery(email ?? '').data;
const user = useUser();
const email = user.user?.emailAddresses?.[0]?.emailAddress;
const isAdmin = api.user.isAdmin.useQuery(email ?? '').data;
...
Solution:
api.user.checkUser.useQuery(email ?? '', {
enabled: user.isSignedIn
});
api.user.checkUser.useQuery(email ?? '', {
enabled: user.isSignedIn
});
`...

Prisma Seed File Temaplate

Does anyone have a template for a seed file and data file to the t3stack template?

Typescript-Eslint Error

```ts import { type Config } from "tailwindcss"; export default { content: ["./src/*/.{js,ts,jsx,tsx}"],...

Pwa + nextauth

Hey, i was wondering if it is possible to somehow cache logged in user for 24hr or so? I wanted to create fully offline experience for user but to use app user must be in session. I use google and magic email link providers + next-pwa.

Next.js Headless CMS for Markdown with MathType support?

I wanna build a blog based on Markdown content based on a headless CMS (using Next.js under the hood). So for this I thought TinaCMS is the right fit. But TinaCMS doesn't support to handle math equations like in the example below. And it doesn't support it in the editor, but also not in the representation. Am I doing something wrong, or is there another Markdown-based CMS that supports this? ``` $$ \eqalign{ (a+b)^2 &= (a+b)(a+b) \...

Using passport-steam and supabase auth in nextjs.

My idea is to let people sign in with discord using supabase. After a successful log in they have a option to "link" their discord account with steam. After the linking process their steam-id should be inserted into the supabase profiles table. Supabase does not have steam as a official authentication provider so i'm using passport-steam for the steam part. The passport-steam strategy looks like this: const SteamStrategy = passportSteam.Strategy; ...

Type safety in apollo server

Big fan of t3/trpc but work uses apollo server. Is there any way to incorporate end to end type safety in apollo server?