Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust types for react 19 #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jantimon
Copy link

This pr upgrades all types to react 19 and removes defaultProps and forwardRef

Right now it is broken because of the use-sidecar types - background is that the JSX types were moved to React.JSX

node_modules/use-sidecar/dist/es5/renderProp.d.ts:7:189 - error TS2503: Cannot find namespace 'JSX'.

7 export declare function renderCar<T extends any[], K, C = RenderPropComponent<T, K & Partial<SideCarHOC>>>(WrappedComponent: C, defaults: (props: K) => T): (props: CombinedProps<T, K>) => JSX.Element;

@moekhalil
Copy link

Is use-sidecar really required? It hasn't been updated in 2 years and seems like a small enough codebase that it could just belong in here. Playing whack-a-mole getting all peerDependencies and their peerDependencies to list "react 19.0.0" is hard enough, just figured less dependencies = the better.

@@ -40,15 +40,15 @@
"enzyme-adapter-react-16": "^1.15.6"
},
"resolutions": {
"@types/react": "^18.0.0",
"@types/react": "^18.0.0 || ^19.0.0",
Copy link
Owner

Choose a reason for hiding this comment

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

resolutions has to point to a specific version.

@@ -21,7 +20,7 @@ const nothing = () => {
/**
* Removes scrollbar from the page and contain the scroll within the Lock
*/
const RemoveScroll: RemoveScrollUIType = React.forwardRef<HTMLElement, IRemoveScrollUIProps>((props, parentRef) => {
const RemoveScroll: RemoveScrollUIType = ({ ref: parentRef, ...props }) => {
Copy link
Owner

Choose a reason for hiding this comment

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

this instantly drops support for anything before React 19 and thus required major version bump.
Not something I can do.

RemoveScroll.defaultProps = {
enabled: true,
removeScrollBar: true,
inert: false,
};
Copy link
Owner

Choose a reason for hiding this comment

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

👍 this could be dropped. Thanks for pointing.

@theKashey
Copy link
Owner

Right now it is broken because of the use-sidecar types - background is that the JSX types were moved to React.JSX

Likely this is where it should be fixed first.

@theKashey
Copy link
Owner

Fixed in 1.1.3 by explicitly typing return of a function. No more auto-inferred JSX https://github.com/theKashey/use-sidecar/blob/master/src/renderProp.tsx#L20

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

Successfully merging this pull request may close these issues.

3 participants