aurelia / validatejs

Enables expressive validation using decorators and/or a fluent API.
MIT License
22 stars 23 forks source link

Decorator failing when descriptor is undefined #85

Closed stefan505 closed 8 years ago

stefan505 commented 8 years ago

I'm trying to use the @email decorator with all the latest bits:

    @email   
    email: string;

This results in the following error:

aurelia-logging-console.js:54 ERROR [app-router] Error: TypeError: Cannot set property 'configurable' of undefined
        at addRule (http://localhost:52058/jspm_packages/npm/aurelia-validatejs@0.5.0/aurelia-validatejs.js:234:29)
        at base (http://localhost:52058/jspm_packages/npm/aurelia-validatejs@0.5.0/aurelia-validatejs.js:220:14)
        at email (http://localhost:52058/jspm_packages/npm/aurelia-validatejs@0.5.0/aurelia-validatejs.js:258:12)

Traced it to this line: https://github.com/aurelia/validatejs/blob/master/src/base-decorator.js#L26

The descriptor seems optional (using TypeScript), what exactly does it mean and how is it used?

export declare function email(targetOrConfig?: any, key?: any, descriptor?: any): any;
ma3yta commented 8 years ago

I have the same https://github.com/aurelia/validatejs/issues/84

jdanyow commented 8 years ago

this is fixed in https://github.com/aurelia/validatejs/commit/178680710ff415a7a388a4ba570033267e0924b6