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.

generated getters/setters for class property assertions break property ownership

See original GitHub issue

This 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:open
  • Created 6 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

1reaction
jedwards1211commented, Jan 22, 2018

I was unable to reproduce this. Would you mind putting your package.json, yarn.lock or package-lock.json if any, .babelrc, and .flowconfig into a gist?

0reactions
phpnodecommented, Feb 8, 2018
Read more comments on GitHub >

github_iconTop 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 >

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