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

Cloud Image Storage

Hi, I was wondering if it is posible that when someone uploads an image it is stored in a google drive folder and in the database it keeps the url to that image?
No description

RRule datetime generation randomly wrong

I am making a project using google calendar. I am using the rrule library to generate dates for event times. ```ts import { z } from "zod"; import { calendar_v3, google } from "googleapis"; import { DateTime } from "luxon";...
Solution:
its dts

T3 stack having a NestJS backend already

I'm working on a side project and so far I have a react native app consuming a NestJS backend with REST API. Now I want to make the web part of it with NextJS. I saw the T3 stack and was wondering if it makes any sense to use it since I already have a REST API and T3 uses tRPC. Is it possible to work with both? Any benefit or better just go simple here...

is manually setting props of a component returned by a render prop considered bad practice?

let's say i have this component: ```tsx function Foo(props: {renderSomething: (param: any) => VNode}) { const rendered = props.renderSomething("hi theo");...
Solution:
```tsx function Foo(props: {renderSomething: (param: any) => VNode}) { const rendered = props.renderSomething("hi theo"); const derivedSomething = useMemo(() => { return {...rendered, someProp: 2}...

Calling same TRPC endpoint from multiple components

Hey! I want to call the same trpc endpoint, with a refetch interval of 5 seconds, from multiple components. How do i make it so each component doesn't send the same request? Can i make the use the same responses somehow? Thanks in advance....

How does the use client directive affect component rendering in Next.js

Does the "use client" directive in TRPCReactProvider mean that all components wrapped by TRPCReactProvider in RootLayout will be rendered on the client side?

which method is better for authentication

i am building an app using mysql , next js , nodejs-express , socket io i am currently in the phase of authentication and registering users in my database with all of their info (email,username,password etc..) the question is do i just encrypt users password in my database when they register into my App or do i use an authentication solution , the registeration data will be sent to the express server where the insertion process will take place in my database when the user sign in i am plannin...

Creating video from images

I have a lot of images in a page, and I want to allow my users to download the images as a video. It'd be great if that can be done on the client side so I don't have to think about or pay for servers. I tried @ffmpeg/ffmpeg but it gives the following error message, even when exactly following the example provided ```ts ⨯ ModuleBuildError: ./node_modules/@ffmpeg/ffmpeg/dist/esm/classes.js:104:28 Module not found...

Using fetch with typescript leads to Unsafe assignment of an `any` value.

Hi all, Is anyone able to tell me why I am receving this linting issue "Unsafe assignment of an any value." when trying to use fetch json response method? ``` export async function GetPlaylist( ctx: TRPCContext,...
No description

Anyone Seeing Static Files Fail to Generate in a Monorepo?

I have a monorepo setup, and I ran the create-t3 script to generate a new web app. Dev was working fine, but whenever I try to build I get an error creating the 500 and 404 pages. If I install dependencies "locally" within the app's directory instead of at the monorepo's project root the build runs successfully. Has anyone else run into this?...

Next.js caching

Hey guys, I'm having a hard time understading what is wrong here. I made a simple repo: https://github.com/HellYeahOmg/revalidate-test Main page has a get request for some items, the second page has a form to add items. After submitting the form i expect to see the updated result on the main page. I added every disabling cache option i could, but it still doesnt work unless i hit router.request() or revalidatePath(). Why so?...

Zed for Windows Custom LSPs (WSL)

Got Zed running on Windows, does anyone know how to tell Zed to look for LSPs in WSL, or to specify custom commands for LSPs?

pre-commit and other git hooks

I do not disagree with Theo on the pre-commit topic. I just watched today's pre-commit video https://www.youtube.com/watch?v=LL01pLjcR5s and coincidentally just yesterday I had rewatched one of his older videos on pre-commit https://www.youtube.com/watch?v=RAelLqnnOp0 I am all about CI/CD and use tools like GH actions a lot, but also admit I have work do do in some projects to build out better CI. ...

Losing typesafety after wrapping json import in a function

I'm trying to follow this guide of localization for next13 where an import of json is made where the object is typesafe but when i return the object from a function there is non. I'm not very well versed in typescript, thanks in advanced!

Failed to parse response from UploadThing server

I get this error when uploading a picture after deployment. It works perfectly fine on my local dev server /api/uploadthing/route.ts ```...
No description

secrets from env file defined in Next config defined leaking in client.

I am using Nextjs 13.4.3, I have defined variables in next config coming from env file like: ```js const nextConfig = { env: { //Google MAPS API KEY...

Make upload delayed possible?

Is there a way to delay file uploads onDrop in Uploadthing? I want to collect all files dropped into the dropbox, but only initiate the actual upload when a "Product" is created. Currently, if a user starts creating a new product, adds images/files, and then leaves the page, I end up with unused and untracked files on Uploadthing. This could lead to unnecessary storage costs for files that serve no purpose. Any suggestions on how to handle this?...

Next.js middleware + Axios

is it possible to set a middleware.ts in next.js to use axios interceptors for certain pages on my app? The code in the snippet below explains better what I want to implement in my middleware.ts for some of my pages....
No description