can-define
can-define copied to clipboard
Using get/set members for DefineMap wildcard properties leads to a reproducible uncaught TypeError
How often can you reproduce it?
- [X] Always
- [ ] Sometimes
- [ ] Rarely
- [ ] Unable
- [ ] I didn’t try
Description:
Creating a DefineMap subclass with wildcard properties that use get/set definitions and then attempting to read any wildcard properties after setting them results in a thrown error that seems to indicate this._computed is not set up properly for wildcard instance properties.
Steps to reproduce:
import { DefineMap } from "//unpkg.com/[email protected]/everything.mjs";
const WildcardMap = DefineMap.extend( "WildcardMap", { seal : false }, {
"*" : {
get( lastSet ) { return lastSet; },
set( value, setValue ) { setValue( value ); }
}
});
let map = new WildcardMap();
map.set( "foo", "bar" );
console.log(map.foo);
Expected results: Console logs "bar"
Actual results: Console reports thrown error:
Uncaught TypeError: Cannot read property 'compute' of undefined
at WildcardMap.get WildcardMap{}.foo (everything.mjs:9608)
Environment:
| Software | Version |
|---|---|
| can-define version | 2.8.0 |
| Browser | Any |
| Operating system | Any |