Donny D
Donny D
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Donny D on 9/29/2023 in #questions
TS, derive type from key of another type
sorry, I forgot to actually post the simpler way lmao:
type DataDisplay = {
name: string;
id: number;
category: Exclude<DataFile, null>['category']
}
type DataDisplay = {
name: string;
id: number;
category: Exclude<DataFile, null>['category']
}
8 replies
TTCTheo's Typesafe Cult
Created by Donny D on 9/29/2023 in #questions
TS, derive type from key of another type
Two things: I think I found a simpler way. And I now realize it won't work, because in the actual thing I'm building for work that I can't share has to factor in translation stuff so the strings 'dog' or 'cat' could ending being different once translated into other values
8 replies
TTCTheo's Typesafe Cult
Created by Donny D on 9/11/2023 in #questions
Enum access question
and I mean in a simple way, I know I can do it with something like Object.values(Options)[Object.keys(Options).indexOf(i)] but that seems needless complex
5 replies
TTCTheo's Typesafe Cult
Created by Lopen on 6/5/2023 in #questions
drizzle orm is overhyped
The term is performance is overshoot so as scalability leading to over engineering P R E A C H
68 replies
TTCTheo's Typesafe Cult
Created by Donny D on 2/1/2023 in #questions
Iterate over an array and create a new sorted object.
I came up with this
const categories = [...new Set(data.map((data) => data.category))];

return categories.map((category) => {
const dataByCategory = _.partition(data, (a) => a.category === category);

return {
label: category,
options: dataByCategory[0].map((a) => {
return {
label: data.name,
value: data.name
}
}
});
const categories = [...new Set(data.map((data) => data.category))];

return categories.map((category) => {
const dataByCategory = _.partition(data, (a) => a.category === category);

return {
label: category,
options: dataByCategory[0].map((a) => {
return {
label: data.name,
value: data.name
}
}
});
7 replies
TTCTheo's Typesafe Cult
Created by Donny D on 2/1/2023 in #questions
Iterate over an array and create a new sorted object.
yeah but that's still experimental
7 replies
TTCTheo's Typesafe Cult
Created by Donny D on 11/25/2022 in #questions
Question about storing data for a substack-like clone?
interesting
8 replies
TTCTheo's Typesafe Cult
Created by Donny D on 10/24/2022 in #questions
Authorization Checking for editing data?
Yeah that's what I've got half-implemented for now. But as I was doing it I wasn't sure if it was the best approach
3 replies
TTCTheo's Typesafe Cult
Created by rovrav on 10/18/2022 in #questions
Pointing to object in array giving me an undefined error in console.log
which is why 57 works and 58 doesn't
5 replies
TTCTheo's Typesafe Cult
Created by rovrav on 10/18/2022 in #questions
Pointing to object in array giving me an undefined error in console.log
and I think this is an issue of the reference being passed to the console
5 replies
TTCTheo's Typesafe Cult
Created by rovrav on 10/18/2022 in #questions
Pointing to object in array giving me an undefined error in console.log
why the recursion?
5 replies
TTCTheo's Typesafe Cult
Created by Donny D on 10/15/2022 in #questions
Please help with complex form query state management mess
wow. works a dream. thanks!
7 replies
TTCTheo's Typesafe Cult
Created by Donny D on 10/15/2022 in #questions
Please help with complex form query state management mess
hmm so I should try putting the setValue() in onSuccess in the chapter query?
7 replies
TTCTheo's Typesafe Cult
Created by Donny D on 10/15/2022 in #questions
Please help with complex form query state management mess
You're trying to set title and content from chapter that you load through query
yes!
7 replies
TTCTheo's Typesafe Cult
Created by Donny D on 10/15/2022 in #questions
Please help with complex form query state management mess
taking a bit of a break now. but I'll try to get a sandbox up later since it's kinda complicated to show what exactly is going wrong
7 replies
TTCTheo's Typesafe Cult
Created by Donny D on 10/15/2022 in #questions
Changing URL but components re-rendering.
I've fixed it, but perhaps somebody more experienced could tell me if this is wrong. I had the defaultValues in the <Controllers /> set, but removed that and now just call setValue('key', chapter.title) after the trpc query returns that data in order to populate the form values. Is this bad practice?
4 replies
TTCTheo's Typesafe Cult
Created by Donny D on 10/15/2022 in #questions
Changing URL but components re-rendering.
oh so I THINK I
4 replies
TTCTheo's Typesafe Cult
Created by Donny D on 10/15/2022 in #questions
Changing URL but components re-rendering.
most of the query data is changing. But I think the issue may lie within react-hook-form somewhere?
4 replies
TTCTheo's Typesafe Cult
Created by Donny D on 10/14/2022 in #questions
trpc.useQuery() succeeding but returning empty data?
Thanks for the rubber ducking
7 replies