question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recommended approach for using flow-typed with peerDependencies

See original GitHub issue

I have a library that exports a number of reusable React components, and I am trying to add flow typings to it. As is best practice for libraries built with React, “react” is listed in both peerDependencies (to specify compatibility with the consuming application) and devDependencies (for component unit tests within my library). However, this configuration does not work with the flow-typed cli because of its duplicate dependency check.

What is the recommended approach for resolving this? Naively, it seems like we might want to allow duplicate dependencies in peerDependencies and devDependencies, but I don’t know what the implications are.

❯ flow-typed version
flow-typed@2.0.0-beta.11

❯ flow-typed install --overwrite
• Found flow-bin@v0.33.0 installed. Installing libdefs compatible with this version of Flow...
UNCAUGHT ERROR: Error: Found react listed twice in package.json!

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:19
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

5reactions
rosskevincommented, Mar 24, 2017

peerDependencies should not be considered a duplicate at all, it is a specification for a runtime dependency. Only dependencies and devDependencies should be considered for duplicates.

5reactions
SimenBcommented, Dec 16, 2016

Could this be fixed? Workaround is just to remove peer at flow-typed install time, but that seems very unnecessary…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding Peer Dependencies in JavaScript
Peer dependencies really come into play when you're developing code that will be used by others, such as plugins and packages.
Read more >
Learning Flow - Alasdair McLeay
I recently came across the following flow type definition: declare export type StyledShorthandFactory<V> = {| [[call]]: <StyleProps, Theme>( string[],
Read more >
@leeruniek/eslint-config - npm
Start using @leeruniek/eslint-config in your project by running `npm i ... JavaScript ESLint bundle with best practices and common use rules for writing ......
Read more >
npm Peer Dependencies - JavaScript inDepth
We use Dependencies and Peer Dependencies in package.json to tell these other projects what packages also need to ... So I recommend the...
Read more >
Using Typescript over Flow. · f790282c08 - react-mui-mapbox ...
"plugin:prettier/recommended". ],. "parserOptions": { ... /flow-typed .rpt2_cache/ ... import for use with developing component from copy of source.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found