MiNiMAL
MiNiMAL
Explore posts from servers
DTDrizzle Team
Created by MiNiMAL on 10/14/2023 in #help
Front to back end type inference with parameters sent via request
Just following up with this article, apparently I’ve been fighting against a tRPC limitation this whole time! https://dev.to/zenstack/limitation-of-trpcs-type-inference-and-how-we-improved-it-47fl
16 replies
DTDrizzle Team
Created by MiNiMAL on 10/14/2023 in #help
Front to back end type inference with parameters sent via request
Really appreciate the time you’ve already taken for me - hope you have a great rest of your weekend
16 replies
DTDrizzle Team
Created by MiNiMAL on 10/14/2023 in #help
Front to back end type inference with parameters sent via request
I’ll play around over the next couple days and batch together any other questions I may have to save you time
16 replies
DTDrizzle Team
Created by MiNiMAL on 10/14/2023 in #help
Front to back end type inference with parameters sent via request
This is incredibly helpful thank you and I really appreciate the effort in pointing me in the right direction. This has been such a fun exercise in improving my typescript skills so I greatly prefer guidance like this.
16 replies
DTDrizzle Team
Created by MiNiMAL on 10/14/2023 in #help
Front to back end type inference with parameters sent via request
Gotcha ok, I’ll look into doing that in the morning, thanks so much! Do you have any guidance on utility types I should be using to build it?
16 replies
DTDrizzle Team
Created by MiNiMAL on 10/14/2023 in #help
Front to back end type inference with parameters sent via request
I definitely won't discount that I may be going about this the wrong way for what it's worth! But I'm super curious if this is feasible because it would perfect the developer experience here.
16 replies
DTDrizzle Team
Created by MiNiMAL on 10/14/2023 in #help
Front to back end type inference with parameters sent via request
No description
16 replies
DTDrizzle Team
Created by MiNiMAL on 10/14/2023 in #help
Front to back end type inference with parameters sent via request
Nested with clauses aside, what about parameters like columns that should directly affect the return value?
export const getEntityFetchProcedures = <TTableName extends TableNames>(
table: TTableName,
) => ({
discordDemo: privateProcedure
.input(
columns =>
({ columns } as {
columns: NonNullable<FindFirstArg<TTableName>>['columns']
}),
)
.query(async ({ input }) => {
const queryRef = db.query[table]
return await queryRef.findFirst(input)
}),
})
export const getEntityFetchProcedures = <TTableName extends TableNames>(
table: TTableName,
) => ({
discordDemo: privateProcedure
.input(
columns =>
({ columns } as {
columns: NonNullable<FindFirstArg<TTableName>>['columns']
}),
)
.query(async ({ input }) => {
const queryRef = db.query[table]
return await queryRef.findFirst(input)
}),
})
16 replies