cstefanache / angular2-img-cropper

Angular 2 Image Cropper
MIT License
364 stars 135 forks source link

Argument of type 'RegExp' is not assingnable to parameter of type 'string' #111

Open koheiokazaki opened 7 years ago

koheiokazaki commented 7 years ago

when I import ng2-img-cropper, this error is happen.

/node_modules/ng2-img-cropper/src/imageCropper.ts (135,28): error TS2345: Argument of type 'RegExp' is not assignable to parameter of type 'string'.

import {ImageCropperComponent, CropperSettings} from 'ng2-img-cropper'; code is here

let regEx = RegExp(/^(data:)([\w\/\+]+);(charset=[\w-]+|base64).*,(.*)/gi);

how to fix it??

FDiskas commented 7 years ago

Try this one :rose:

let regEx = new RegExp('^(data:)([\w\/\+]+);(charset=[\w-]+|base64).*,(.*)', 'gi');

https://hassantariqblog.wordpress.com/2017/05/18/angularjs-error-argument-of-type-regexp-is-not-assignable-to-parameter-of-type-string/