Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw warning when extending an already extended map #285

Open
1 of 5 tasks
Macrofig opened this issue Oct 31, 2017 · 1 comment
Open
1 of 5 tasks

Throw warning when extending an already extended map #285

Macrofig opened this issue Oct 31, 2017 · 1 comment

Comments

@Macrofig
Copy link

How often can you reproduce it?

  • Always
  • Sometimes
  • Rarely
  • Unable
  • I didn’t try

Description:

Extending an already extended map yield unexpected results.

Plugin example

const ViewModel = can.DefineMap.extend({
  name: {
    value: 'juan'
  }
});

const Test = ViewModel.extend({
  name() {
    return 'Juan';
  }
});

The second extended Map's should throw a warning. The eventually created instance may not behave as expected when attempting to set/get name.

Steps to reproduce:

http://jsbin.com/taxezah/2/edit?js,console

  1. Create a define map using extend.
  2. Then extend that map.
  3. Finally, create an instance of the extended map. This becomes a little more confusing when the original map has a static value but the extended map has a getter/compute for the same property.

Expected results:

A warning should be thrown when extending an already extended map.

Actual results:

No warning is currently thrown.

Environment:

Software Version
can-define version 1.5.1
Browser Chrome 61.0.3163.100
Operating system MacOS 10.13
@justinbmeyer
Copy link
Contributor

justinbmeyer commented Jun 2, 2018

I'm not sure if the warning should be on extension or at least on setting the .name property.

Note that if you are running in strict mode it does throw an error: http://jsbin.com/yimiyuz/1/edit?html,js,console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants