Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

fix Form ref #32

Closed
wants to merge 3 commits into from
Closed

Conversation

Filipo11021
Copy link
Contributor

#31

@changeset-bot
Copy link

changeset-bot bot commented Sep 6, 2022

⚠️ No Changeset found

Latest commit: 3a2df20

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Sep 6, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
next-swr-endpoints-example-app ✅ Ready (Inspect) Visit Preview Nov 21, 2022 at 2:53AM (UTC)
1 Ignored Deployment
Name Status Preview Updated
next-fetch ⬜️ Ignored (Inspect) Nov 21, 2022 at 2:53AM (UTC)

Comment on lines 36 to 41
// 4. https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref/58473012#58473012
declare module "react" {
function forwardRef<T, P = {}>(
render: (props: P, ref: React.ForwardedRef<T>) => React.ReactElement | null
): (props: P & React.RefAttributes<T>) => React.ReactElement | null;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry about this changing customer code because AFAIK TypeScript declarations are global. Maybe we should "unsafely" type-cast?

// typed-forward-ref.ts

import { forwardRef as forwardRef_ } from "react";
const forwardRef = forwardRef_ as unknown as TYPEDEF_HERE;
export default forwardRef;

wdyt? 👀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants