Flow error: Cannot use conditional as a computed property
See original GitHub issueI’m seeing these errors, using Flow 0.123.0. Also seeing them on the version of flow used by this repo if I paste the code into try flow.
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/react-window/src/createGridComponent.js:615:12
Cannot use conditional [1] as a computed property. Computed properties may only be primitive literal values, but
conditional [1] is a union. Can you add a literal type annotation to conditional [1]? See
https://flow.org/en/docs/types/literals/ for more information on literal types.
612│ } else {
613│ itemStyleCache[key] = style = {
614│ position: 'absolute',
[1] 615│ [direction === 'rtl' ? 'right' : 'left']: getColumnOffset(
616│ this.props,
617│ columnIndex,
618│ this._instanceProps
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/react-window/src/createListComponent.js:471:12
Cannot use conditional [1] as a computed property. Computed properties may only be primitive literal values, but
conditional [1] is a union. Can you add a literal type annotation to conditional [1]? See
https://flow.org/en/docs/types/literals/ for more information on literal types.
468│
469│ itemStyleCache[index] = style = {
470│ position: 'absolute',
[1] 471│ [direction === 'rtl' ? 'right' : 'left']: isHorizontal ? offset : 0,
472│ top: !isHorizontal ? offset : 0,
473│ height: !isHorizontal ? size : '100%',
474│ width: isHorizontal ? size : '100%',
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
'computed property' may only be literal values in flow?
Flow complains about the last line, saying cannot use MyA as a computed property, computed properties must be primitive literal values.
Read more >Spreads: Common Errors & Fixes - Flow - Medium
Instead of inferring a 10k large object union, Flow will emit an error saying that you cannot use a union as a computed...
Read more >setter - JavaScript - MDN Web Docs
The set syntax binds an object property to a function to be called when there is an attempt to set that property. It...
Read more >Computed Properties - Vue.js
A computed property will only re-evaluate when some of its reactive dependencies have changed. This means as long as author.books has not changed,...
Read more >Asynchronous Flow | Kotlin Documentation
builder block can suspend. The simple function is no longer marked with a suspend modifier. Values are emitted from the flow using an ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So it turns out this was only a temporary solution. I intended to put up a PR with a fix, but when I pulled down the repo I noticed the necessary changes were already there.
@bvaughn Can you make a release with the latest changes?
In the mean time, I can confirm that
"react-window": "bvaughn/react-window#master"
in my package.json is working well for me. 👍Definitely not a solution I’m happy to suggest either way. I actually ended up pulling the code I needed from this repo and put it directly into my codebase. Kind of a pain but it’s not a ton of code 🤷♂️