generated getters/setters for class property assertions break property ownership
See original GitHub issueThis is a:
- Bug Report
- Feature Request
- Question
- Other
Which concerns:
- flow-runtime
- babel-plugin-flow-runtime
- flow-runtime-validators
- flow-runtime-mobx
- flow-config-parser
- The documentation website
When I trying to clone my object with lodash clone method, it loses values of object properties:
// @flow
import { clone } from 'lodash'
class A {
prop: number
constructor(prop: number) {
this.prop = prop
}
}
test('cloning of typed objects', () => {
const a = new A(42)
const copy = clone(a)
expect(a).not.toBe(copy)
expect(copy.prop).toBe(42)
})
With example above I got a error from jest:
FAIL a.spec.js
✕ cloning of typed objects (6ms)
● cloning of typed objects
expect(received).toBe(expected)
Expected value to be (using ===):
42
Received:
undefined
What is the expected behaviour?
It should returns cloned object with setted properties and works correctly with lodash, because it’s popular package from npm.
Which package versions are you using?
- flow-runtime - 0.16
- babel-plugin-flow-runtime - 0.15
- lodash - 4
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:7
Top Results From Across the Web
Using @property versus getters and setters - Stack Overflow
Prefer properties. It's what they're there for. The reason is that all attributes are public in Python. Starting names with an underscore or ......
Read more >Core Features - Spring
Devtools global settings properties in the $HOME/.config/spring-boot directory ... (getters/setters) of the class itself are not meant to be used directly.
Read more >Object orientation - The Apache Groovy programming language
They may have methods, fields and properties (think JavaBeans properties but with less ... Groovy will then generate the getters/setters appropriately.
Read more >2023 Guide for Property Owners
B . Wisconsin Property Assessment Manual (WPAM) . ... On the form, the property owner requests an exemption under a specific state law...
Read more >Property Tax Assessment - Alabama Department of Revenue
Property Classes ; II, All property not otherwise classified, 20% ; III, All agricultural, forest, and single-family owner occupied residential property, ...
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
I was unable to reproduce this. Would you mind putting your
package.json
,yarn.lock
orpackage-lock.json
if any,.babelrc
, and.flowconfig
into a gist?@jedwards1211 yeah it’s a little bit tricky / messy, this particular transform happens in https://github.com/codemix/flow-runtime/blob/master/packages/babel-plugin-flow-runtime/src/transformVisitors.js#L789