Skip to content

Commit 378121e

Browse files
authored
fix(ts): fix types (#827)(#823)
1 parent 4599fef commit 378121e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/PagerView.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,9 @@ export const PagerView = React.forwardRef<PagerViewInternal, PagerViewProps>(
233233
return <PagerViewInternal {...rest} useLegacy={!useNext} ref={ref} />;
234234
}
235235
);
236+
237+
// React.forwardRef does not type returned component properly, thus breaking Ref<MyComponent> typing.
238+
// One way to overcome this is using separate typing for component "interface",
239+
// but that breaks backward compatibility in this case.
240+
// Approach of merging type is hacky, but produces a good typing for both ref attributes and component itself.
241+
export type PagerView = PagerViewInternal & typeof PagerView;

0 commit comments

Comments
 (0)