17 Replies
.ts is for typescript, the others for javascript. For the difference between .mjs and .js see: https://stackoverflow.com/questions/57492546/what-is-the-difference-between-js-and-mjs-files
Stack Overflow
What is the difference between .js and .mjs files?
I have started working on an existing project based on Node.js. I was just trying to understand the flow of execution, where I encountered with some *.mjs files. I have searched the web where I found
Let's say I have some utils functinos
Should I put them in .js or .ts files?
Is this using the t3 stack? Or on projects in general?
t3
The t3 stack uses typescript, as such the files should .ts
Side note: nothing is stopping you from using .js, that will also work. But since it is typescript, the extension should indicate that
I have this function that I apply to the Date prototype, it keeps giving me the error "Object is not defined"
for the keyword "this"
By using .js, wouldn't that just completely forfeit the idea of trpc
there is no this in arrow functions
Don't do this, just have a function that has date as input
ok thanks! My react component takes in a response object, how do I (do I need to) specify the type in the argument?
Im a ocmplete TS newbie
React.FC<{ res: Response, currentUser: User | null }>
is the type
or something like thisWhere would I get the Response and User? I think it should come from Zod no?
there is a
useSession
hook in NextAuth for getting the current userI thought there's a way to infer the type
You can infer all types, yes
Do you know of a tutorial that shows this
my understanding is all the types can be inferred from schema.prisma
Am I mistaken?
.ts because you'll be writing them in typescript files