styled-components: Flow errors being returned in 1.4.3
Version
1.4.3
Description
Previously hedron has been using styled-components
1.1.3, but after updating to 1.4.3, flow has started giving me an error when running flow
inside my repos directory.
node_modules/styled-components/dangerfile.js:3
3: import { danger, warn, fail, message } from 'danger'
^^^^^^^^ danger. Required module not found
node_modules/styled-components/lib/models/StyleSheet.js.flow:18
18: get injected(): boolean {
^ Potentially unsafe get/set usage. Getters and setters with side effects are potentially unsafe and disabled by default. You may opt-in to using them anyway by putting `unsafe.enable_getters_and_setters=true` into the [options] section of your .flowconfig.
Found 2 errors
I’m not extremely well versed in flow, so I’m not 100% sure it’s not a problem in my configuration of flow. But since it has previously been working fine, I’m thinking it must be related to styled-components
. The second error looks like I can resolve it with the suggested .flowconfig
change, but I’m not sure about the first one.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 19 (10 by maintainers)
@0x80 You should remove everything styled-components related from your
[libs]
section… so it should look like this:Don’t know if this is related, but I’m getting a whole slew of Flow errors, and I used
flow-typed install
to grab the libdefs.Ah, okay… well, I still couldn’t find any API on the docs, so it’s hard to tell what public API it should expose (@mxstbr ?) …
For now, you can fix this by adding this to your styled-components libdef:
Not the cleanest solution, but hey: a good foundation for a contribution? 😄
@0x80 @hph See updated docs in #656 as it has not been merged yet.
The second error is strange, because it is in the config 😕
https://github.com/styled-components/styled-components/blob/master/.flowconfig#L18
Edit: Oh, if you rely on the flow types, you don’t inherit the config.