You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand need for this, I've done this in the past myself, but having this in the library code isn't acceptable. This impacts end users type definitions.
src/components/map.tsx
// Redecalare forwardRef to support generics
// https://fettblog.eu/typescript-react-generic-forward-refs/
declare module 'react' {
function forwardRef<T, P = {}>(
render: (props: P, ref: React.Ref<T>) => React.ReactElement | null
): (props: P & React.RefAttributes<T>) => React.ReactElement | null;
}
For example anyone using shadcn/ui or basically anyone using displayName will now see error:
Property 'displayName' does not exist on type '(props: Omit<AvatarProps & RefAttributes<HTMLSpanElement>, "ref"> & RefAttributes<HTMLSpanElement>) => ReactElement<...> | null'.
Inspecting forwardRef type declaration will point at your code:
Expected Behavior
Do not impact global type declarations for end user.
Description
I understand need for this, I've done this in the past myself, but having this in the library code isn't acceptable. This impacts end users type definitions.
src/components/map.tsx
For example anyone using shadcn/ui or basically anyone using
displayName
will now see error:Property 'displayName' does not exist on type '(props: Omit<AvatarProps & RefAttributes<HTMLSpanElement>, "ref"> & RefAttributes<HTMLSpanElement>) => ReactElement<...> | null'.
Inspecting forwardRef type declaration will point at your code:
Expected Behavior
Do not impact global type declarations for end user.
Steps to Reproduce
displayName
Environment
Framework version: react-map-gl@7.1.0
Map library: mapbox-gl@2.15.0
Browser: doesn't matter
OS: doesn't matter
Logs
No response
The text was updated successfully, but these errors were encountered: