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

Remove @types/* from dependencies #6299

Closed
3 tasks done
gmukul01 opened this issue Apr 8, 2022 · 6 comments
Closed
3 tasks done

Remove @types/* from dependencies #6299

gmukul01 opened this issue Apr 8, 2022 · 6 comments
Labels

Comments

@gmukul01
Copy link

gmukul01 commented Apr 8, 2022

Prerequisites

Describe the bug

@types/* being added in dependencies instead of devDependencies.

Expected behavior

@types/* should be added in devDependencies

To Reproduce

No response

Reproducible Example

There are no steps to reproduce it.

Screenshots

No response

What operating system(s) are you seeing the problem on?

No response

What browser(s) are you seeing the problem on?

No response

What version of React-Bootstrap are you using?

2.2.2

What version of Bootstrap are you using?

5.1.3

Additional context

No response

@gmukul01 gmukul01 added the bug label Apr 8, 2022
@gmukul01 gmukul01 changed the title Remove @types/react from dependencies Remove @types/* from dependencies Apr 8, 2022
@jquense
Copy link
Member

jquense commented Apr 8, 2022

Types are supposed to be in dependencies because they need to be installed when some one installs the package. Other wise typescript will not be able to correctly typecheck when you use react-bootstap

@jquense jquense added types and removed bug labels Apr 8, 2022
@gmukul01
Copy link
Author

gmukul01 commented Apr 9, 2022

@jquense At least we can move it to peerDependency. Keeping it in dependency is failing in our project because it is installing latest version on react types(v18) which is not compatible as of now in our project.

@kyletsang
Copy link
Member

The react types should've been deduped if you already have it in declared in your project package.json? It shouldn't have installed a copy of the react 18 types.

Can you try this command in your project? npm ls @types/react

@gmukul01
Copy link
Author

gmukul01 commented Apr 18, 2022

@kyletsang @jquense This is the result of npm ls @types/react. I have also fixed the version of @types/react to 17, but still the latest version of @types/react is getting installed.

image

image

The above dependency is coming from react-bootstrap
image

@golota60
Copy link
Collaborator

related: facebook/react#24304 (comment)

Declaring @types/react as an (optional) peer dependency is the correct solution.

here's how MUI does it cc @kyletsang

@kyletsang
Copy link
Member

Optional peer deps is the correct approach. I think we've tried adding this in the past but most people were still on versions of npm that doesn't support this. It's been long enough now, so I've opened #6303 to properly clean this up.

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

Successfully merging a pull request may close this issue.

4 participants