for-ui
for-ui copied to clipboard
forwardRefを使っているComponentのrefの型が異なる
Props型をexportしているだけだとrefがMUI由来のものが使われてしまってエラーが起きることがある
type _CheckboxProps = { ... }
export const Checkbox = forwardRef<HTMLInputElement, _CheckboxProps> = forwardRef(...)
export type CheckboxProps = ComponentPropsWithRef<typeof Checkbox>
のように定義する
asのキャストを使わずにもできそう ref: #1230