aurelia / validatejs

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

Getting aurelia-validatejs.d.ts cannot find module 'validate.js' with webpack #67

Closed da1z closed 8 years ago

da1z commented 8 years ago

Getting this error when trying to use aurelia-validatejs

plwalters commented 8 years ago

Tracking at #10

y2k4life commented 8 years ago

If this is the error you received

ERROR in ........\typings\modules\aurelia-validatejs\index.d.ts
(14,24): error TS2307: Cannot find module 'validate.js'.

I commented line 14 import validate from 'validate.js'; of the aurelia-validatejs.d.ts file. I also had to add validate(): any; after line 82 of the aurelia-validatejs.d.ts file, the Validator class.

I don't know if my solution is the solution, but I got it to work, so to me that is a solution. There might be a better fix to it.

My opinion after reviewing the aurelia-validatejs.d.ts file is that it was built to get things to work. To have strongly typed system like TypeScript but to build everything with any to my is not leveraging the TypeScript. I understand that any is the only type that can be used for some instances, but to make everything any is code smell to me. I'm reviewing to file to see if any improvements can be made or if using any for everything is the only way it can be built.

After these changes I was able to get the code to work, but I don't see any output on the view. I leave a filed blank, press a validate button and I don't see an error. But after debugging and tracing the code I do see that the validation errors are trapped, just not displayed.