aurelia / validatejs

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

TypeScript error: Module ''validate.js'' has no default export #112

Closed kristianmandrup closed 8 years ago

kristianmandrup commented 8 years ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior:

node_modules/aurelia-validatejs/dist/aurelia-validatejs.d.ts(8,8): error TS1192: Module ''validate.js'' has no default export.

Visual Studio code also complains with a red underline under validate constant in import validate from 'validate.js';

Expected/desired behavior:

That it can load aurelia-validatejs type definitions without error

albimcleod commented 8 years ago

I have a similar issue also, but with WebPack.

Running locally is fine, but building for deployment throws an error in WebPack

xmichaelx commented 8 years ago

I have similar issue but with skeleton-typescript-webpack both locally and deployment. @am2software how did you set it up so you don't get that error on npm start ?

kristianmandrup commented 8 years ago

I had a similar issue for sortablejs which I solved like this.

import sortable = require('sortablejs');

So try:

import validate = require('validate');

Found hint here: http://stackoverflow.com/questions/35277354/module-resolves-to-a-non-entity-module-and-cannot-be-imported-using-this-c

albimcleod commented 8 years ago

@kristianmandrup that has resolved my issue

in aurelia.validatejs.d.ts change import validate from 'validate.js'; into import validate = require('validate.js');

kristianmandrup commented 8 years ago

Cute ;) I had to do a similar fix for sortable.js, renaming the export variable in the d.ts file

xmichaelx commented 8 years ago

Could this fix be included in next version of aurelia.validatejs.d.ts?