JacobParis
JacobParis
TTCTheo's Typesafe Cult
Created by Liam on 7/27/2023 in #questions
Add Generic To Response in Next
In general, if the response cannot infer from its own body what the type is going to be, you won't be able to pass it a type and expect that to be guaranteed either
7 replies
TTCTheo's Typesafe Cult
Created by Liam on 7/27/2023 in #questions
Add Generic To Response in Next
but if there's a chance things could get out of sync (basically: that zod validator hasn't already parsed this output) then you could end up where Typescript says it's ok but it isn't and it will fail at runtime
7 replies
TTCTheo's Typesafe Cult
Created by Liam on 7/27/2023 in #questions
Add Generic To Response in Next
If you trust your backend code and know it will be that type, then that's ok
7 replies
TTCTheo's Typesafe Cult
Created by Liam on 7/27/2023 in #questions
Add Generic To Response in Next
With any static typing you're lying to the code anyway, so best is an explicit assertion NextResponse.json() as Type If you want runtime safety, you can use Zod to validate the type
return NextResponse.json(schema.parse({}))
return NextResponse.json(schema.parse({}))
7 replies
TTCTheo's Typesafe Cult
Created by maskmonarch on 7/26/2023 in #questions
React not updating the attribute for an HTML element
Have you verified that production reflects your latest code and there wasn't an issue with deploy or maybe caching that file so it's a stale version?
25 replies
TTCTheo's Typesafe Cult
Created by Vincent Udén on 7/27/2023 in #questions
VS Code Plugin showing gzipped size of imports
It's called import cost by Wix
5 replies
TTCTheo's Typesafe Cult
Created by oadster on 7/10/2023 in #questions
How do you get query params in Next13, app router w/ route.ts file?
query params are part of the URL
const url = new URL(request.url)
url.searchParams.get("q")
const url = new URL(request.url)
url.searchParams.get("q")
3 replies
TTCTheo's Typesafe Cult
Created by bento on 7/10/2023 in #questions
React table filter type error (.toLowerCase)
I don't see in your code example where you're calling toLowerCase but you probably want at the end
column.setFilterValue(filterValues.length
? filterValues.map(value => value.toLowerCase())
: undefined
)
column.setFilterValue(filterValues.length
? filterValues.map(value => value.toLowerCase())
: undefined
)
8 replies
TTCTheo's Typesafe Cult
Created by bento on 7/10/2023 in #questions
React table filter type error (.toLowerCase)
If you want to lowercase the elements in your array, use a map instead
filterValues.map(value => value.toLowerCase())
filterValues.map(value => value.toLowerCase())
8 replies
TTCTheo's Typesafe Cult
Created by General Mudkipp on 7/5/2023 in #questions
Headless UI Transitions
It does create a parent div, though you do have the option to pass <Transition as={React.Fragment}
9 replies
TTCTheo's Typesafe Cult
Created by General Mudkipp on 7/5/2023 in #questions
Headless UI Transitions
one of the biggest gotchas with HeadlessUI's transition component is that classes in the enter, enterFrom, etc aren't detected by tailwind by default
9 replies