We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I created this SO question where I describe the problem I have with decorators and arguments.
With ember-cli-babel 5, I can do this :
import DS from 'ember-data'; import {alias} from 'ember-computed-decorators'; export default DS.Model.extend({ @alias('customData.email') email });
It worked. With ember-cli-babel 6 I have this error : and I have this message email is not defined.
email is not defined
Here is what's generated by ember-cli-babel 5 (without babel-plugin-transform-decorators-legacy) :
define('tiny/models/subscription', ['exports', 'ember-data', 'ember-computed-decorators'], function (exports, _emberData, _emberComputedDecorators) { function _createDecoratedObject(descriptors) { var target = {}; for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = true; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } } if (descriptor.initializer) { descriptor.value = descriptor.initializer.call(target); } Object.defineProperty(target, key, descriptor); } return target; } exports['default'] = _emberData['default'].Model.extend(_createDecoratedObject([{ key: 'mail', initializer: function initializer() { return _emberData['default'].attr(); } }, { key: 'email', decorators: [(0, _emberComputedDecorators.alias)('mail')], initializer: function initializer() { return email; } }])); });
Here is what's generated by ember-cli-babel version 6 (with babel-plugin-transform-decorators-legacy) :
define('tiny/models/subscription', ['exports', 'ember-data', 'ember-computed-decorators'], function (exports, _emberData, _emberComputedDecorators) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object['define' + 'Property'](target, property, desc); desc = null; } return desc; } var _dec, _desc, _value, _obj, _init; exports.default = _emberData.default.Model.extend((_dec = (0, _emberComputedDecorators.alias)('mail'), (_obj = { email: email }, (_applyDecoratedDescriptor(_obj, 'email', [_dec], (_init = Object.getOwnPropertyDescriptor(_obj, 'email'), _init = _init ? _init.value : undefined, { enumerable: true, configurable: true, writable: true, initializer: function initializer() { return _init; } }), _obj)), _obj))); });
Is it bug
The text was updated successfully, but these errors were encountered:
Hit this problem too, but I'm using with mongoose model.
Sorry, something went wrong.
@zaaack You have to do this :
import DS from 'ember-data'; import {alias} from 'ember-computed-decorators'; export default DS.Model.extend({ @alias('customData.email') email: null });
Just add : null. This is a bug and this is in investigation as you can see here.
: null
@GCorbel,thanks, I'm using with class and turns out it's my I misunderstood about this plugin.
No branches or pull requests
I created this SO question where I describe the problem I have with decorators and arguments.
With ember-cli-babel 5, I can do this :
It worked. With ember-cli-babel 6 I have this error : and I have this message
email is not defined
.Here is what's generated by ember-cli-babel 5 (without babel-plugin-transform-decorators-legacy) :
Here is what's generated by ember-cli-babel version 6 (with babel-plugin-transform-decorators-legacy) :
Is it bug
The text was updated successfully, but these errors were encountered: