-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Milestone
Description
In the generated models, when there are enum, an extra segment is introduced, like
//export module
if ( typeof define === "function" && define.amd ) {
define('SomeTypeEnum', [], function() {
return SomeTypeEnum;
});
}This has the effect that
- If the module system is AMD, this will just export the enum, and not the main model class
- If the module system is not AMD, this will just export the model class, and not the enum
The import/export setup also seems a bit inconsistent and strange in general. We are using both returns and setting the "module" parameter. Shouldn't we be using this UMD template?
I propose that the way we export enums should be as a property of the module class itself. For example, we might have a module Account which includes an enum AccountType. Then, we should export these (using the style in the template I linked to above) using
exports = Account;
exports.AccountType = AccountType;Reactions are currently unavailable