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

ESLint running on CSS?

0:0 error Parsing error: ESLint was configured to run on `<tsconfigRootDir>/src/styles/globals.css` using `parserOptions.project`: /path/to/project/tsconfig.json
The extension for the file (`.css`) is non-standard. You should add `parserOptions.extraFileExtensions` to your config
0:0 error Parsing error: ESLint was configured to run on `<tsconfigRootDir>/src/styles/globals.css` using `parserOptions.project`: /path/to/project/tsconfig.json
The extension for the file (`.css`) is non-standard. You should add `parserOptions.extraFileExtensions` to your config
...

Analytics w/ RSC

Trying out the App Router for my blogsite. My blogsite is mostly a static website and is a perfect candidate for RSC. However, I do a lot of tracking about interactions on my blog page - e.g. if you click a link to another blog post, I send an analytics event for a BUNCH of data. These events are sent on the onClick event handler of the <a> tag. Now the blog link is a completely static component that is perfect for RSC, but I also would have to send JS to do that tracking. How should I build this ? I hate to convert this to a client side component. It feels weird to send Javascript w/ a component for purely tracking purposes that does nothing to the UX. A static link, on paper, should be the perfect candidate to send 0 JS w/ it. ...

Background image not loading? Help #noob

so I want there to be a background image on my sign-in page and i put that inside of a cover css class but its not loading

Building your own UI using clerk & t3

Hello, Im currently trying to create a custom sign-up page and sign-in page following the Clerk Documentation https://clerk.com/docs/users/build-your-own-ui#theming-customization. I'm running into some troubles I was wondering if someone could help me out? I added all of the required files and updated my _app.tsx to reflect the example but whenever an unsigned in user hits my website it just redirects them to this page instead of a page looking like this. Any ideas what could be going wrong? 😩

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!...
Solution:
if Im not mistaken (because I dont use prettier), you can have a root file for prettier and specialize/extend it on each project for their necessities. I believe there are examples online on how to better setup this.

Is there a way to import a type from a Prisma Model on Client

I know that we have inferRouterInputs and inferRouterOutputs, but I dont feel that is what I need. TRPC provides a way to generate a type from model? or the right only way is literally the output?...

The "experimental-edge" flag in nextjs allows me to deploy websocket in vercel?

I know that websocket cannot be used in vercel because it is serverless. However, I understand that edge is not serverless, hence my doubt....

How do I add "connect social platform" to my website? (not social login)

I'm not sure how to describe this feature. It's basically this from Twitch https://www.twitch.tv/settings/connections Has anyone implemented something like this before?...

Should I share packages on Turborepo?

I have 2 clients on my app, and I notice they literally have almost all the same dependencies. What I havent understood well about monorepo is about sharing dependencies, I have a package.json at Root of the project and each one for each project. Yesterday I had to import one package that I didnt had on a specific project but had in other and it work without install and I was WTF ...

how come when i start a new typescript project, eslint breaks?

Hey yall! Im trying to get eslint setup and working with typescript in just a regular node project. However its giving me this weird error:...

Prisma types from t3 turborepo db package

I am working on a project using the t3-turbo monorepo template. When using the packages/db package in other packages, the types do not autocomplete or auto-import. It seems as if the @project/db dependency does not export anything other than a prisma object of type any. When manually writing the types into the import, it works and Typescript realizes that the package does in fact export these types. How can I improve DX around this and get the types to work automatically?...

How do I use ISR with t3 app.

I'm trying to figure out how to do my trpc queries in getStatic props. I can't seem to use useQuery() . Do I need to make any special alterations to my trpc.ts file to enable it?

Next-Auth Session in Server Function

Trying out the new app directory with an example project and ran into issues with accessing the user session within a server function via getServerSession ```jsx "use server"; ...

Formik, React-Datepicker error

I am getting TypeError: Cannot read properties of undefined (reading 'type') when I try to pick a date with the
```jsx...

"SyntaxError: Cannot use import statement outside a module" when attempting to build a turborepo app

I have a turbo repo that has a websocket app. I have a package for my redis client so it can be used in all my apps. However when I try to start my websocket app in production I get ```F:\Dev\radiance\packages\redis\index.ts:1 import Redis, { type RedisOptions } from "ioredis"; ^^^^^^ SyntaxError: Cannot use import statement outside a module...
Solution:
Solved it by removing type module, and adding ts loader to esbuild.

Vercel and installing Julia

Is there a way to install Julia in a NextJS app deployed onto Vercel? Currently, this is my approach.
// src/pages/index.jsimport { useState } from "react";export default function Install() { const [message, setMessage] = useState(""); async function installJulia() { try { const response = await fetch("/api/installJulia", { method: "POST", headers: { "Content-Type": "application/json", }, }); const data = await response.json(); console.log(data); setMessage(JSON.stringify(data)); } catch (error) { console.error("Error:", error); setMessage("An error occurred while installing Julia."); } } return ( <main className="flex min-h-screen flex-col items-center justify-between p-24"> <button onClick={installJulia}>Install Julia</button> {message && <p className="mt-4 text-center text-red-600">{message}</p>} </main> );}
// src/pages/index.jsimport { useState } from "react";export default function Install() { const [message, setMessage] = useState(""); async function installJulia() { try { const response = await fetch("/api/installJulia", { method: "POST", headers: { "Content-Type": "application/json", }, }); const data = await response.json(); console.log(data); setMessage(JSON.stringify(data)); } catch (error) { console.error("Error:", error); setMessage("An error occurred while installing Julia."); } } return ( <main className="flex min-h-screen flex-col items-center justify-between p-24"> <button onClick={installJulia}>Install Julia</button> {message && <p className="mt-4 text-center text-red-600">{message}</p>} </main> );}
...

"PrismaClient is unable to be run in the browser" in Next.js API route

Title. I have an API route that returns an ImageResponse, and it's showing this error when I try to open it in the browser, doesn't make sense:

Cant use the same router to create multiple createTRPCReact?

Im working in a monorepo where I have 2 clients consuming the same server with trpc. both client are react app created with vite, installed the same dependencies and the same folder structure. the latest project Ive created I literally cant create the trpc instance using the same serverRouter I am using on the other app. is literally the same code lol...

Clerk not saving username

I am stuck with Theo course as I am noticing he is requesting username from the user being logged in but my username for some reason is null. Any idea why that might be the case? I used both my email and github to login to the application but it never gets updated for some reason. Thanks for the clarity 😄...