praskoo
praskoo
TTCTheo's Typesafe Cult
Created by praskoo on 8/15/2023 in #questions
When using pnpm instead of npm, my .d.ts declaration files don't work.
In case anyone finds this, the solution was installing csstype (pnpm add -D csstype), because of how pnpm resolves dependencies versus npm.
3 replies
TTCTheo's Typesafe Cult
Created by praskoo on 4/18/2023 in #questions
Webhooks correct terminology
Thanks for the insights, I think the approach with adding an additional term to further specify what I'm talking about is the best way
7 replies
TTCTheo's Typesafe Cult
Created by arete on 4/4/2023 in #questions
shadcn ui and react hook form
Your TextInput component should look a bit like this by the end:
const TextInput = React.forwardRef<HTMLInputElement, Props>(function TextInput(props, ref) {
return <input ref={ref} {...props} />
})
const TextInput = React.forwardRef<HTMLInputElement, Props>(function TextInput(props, ref) {
return <input ref={ref} {...props} />
})
16 replies
TTCTheo's Typesafe Cult
Created by arete on 4/4/2023 in #questions
shadcn ui and react hook form
But that ref needs to be passed down to the inner <input> that's within your <TextInput> component (presumably). To do that, you need to use React.forwardRef
16 replies
TTCTheo's Typesafe Cult
Created by arete on 4/4/2023 in #questions
shadcn ui and react hook form
Basically, when you add {...register(..)} to props, one of the props that it will try to pass down is ref
16 replies
TTCTheo's Typesafe Cult
Created by arete on 4/4/2023 in #questions
shadcn ui and react hook form
In particular the "Accessing another component's DOM nodes" part
16 replies
TTCTheo's Typesafe Cult
Created by arete on 4/4/2023 in #questions
shadcn ui and react hook form
The documentation here should help you understand the error message: https://react.dev/learn/manipulating-the-dom-with-refs
16 replies
TTCTheo's Typesafe Cult
Created by Jim on 3/19/2023 in #questions
How do headless-ui expose context variable for child components?
20 replies
TTCTheo's Typesafe Cult
Created by Jim on 3/19/2023 in #questions
How do headless-ui expose context variable for child components?
I believe my stuff is entirely client rendered. I'll create a gist with the Select component (wrapper around Listbox), maybe it helps.
20 replies
TTCTheo's Typesafe Cult
Created by Jim on 3/19/2023 in #questions
How do headless-ui expose context variable for child components?
Ah, I'm not sure about server/client rendering
20 replies
TTCTheo's Typesafe Cult
Created by Jim on 3/19/2023 in #questions
How do headless-ui expose context variable for child components?
To me it looks like you were on the right track at least
20 replies
TTCTheo's Typesafe Cult
Created by Jim on 3/19/2023 in #questions
How do headless-ui expose context variable for child components?
For example, in the H/UI Listbox component, the children are typed as:
const children: React.ReactNode | ((bag: ListboxRenderPropArg<TType>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>)
const children: React.ReactNode | ((bag: ListboxRenderPropArg<TType>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>)
20 replies
TTCTheo's Typesafe Cult
Created by Jim on 3/19/2023 in #questions
How do headless-ui expose context variable for child components?
I didn't exactly nail it, I still ended up with some bugs, but I could share some of that code if it helps
20 replies
TTCTheo's Typesafe Cult
Created by Jim on 3/19/2023 in #questions
How do headless-ui expose context variable for child components?
I was working on sort-of wrapping the Headless-UI components so that I could create reusable UI components, the goal was to basically have some base classes, but still keep the same pattern, where children could consume props from parents
20 replies
TTCTheo's Typesafe Cult
Created by Ekaradon on 3/16/2023 in #questions
Typescript error when using tailwind Container queries plugin
Idk if im missing something, but why is it asking for a declaration file in .cjs 🤔
11 replies
TTCTheo's Typesafe Cult
Created by Ekaradon on 3/16/2023 in #questions
Typescript error when using tailwind Container queries plugin
I did
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
require("@tailwindcss/container-queries"),
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
require("@tailwindcss/container-queries"),
11 replies