Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngx-custom-validators 9.x embed @angular in distribution #33

Open
bjornharvold opened this issue Mar 26, 2020 · 22 comments
Open

ngx-custom-validators 9.x embed @angular in distribution #33

bjornharvold opened this issue Mar 26, 2020 · 22 comments
Labels

Comments

@bjornharvold
Copy link

Steps to reproduce and a minimal demo

  • I upgraded app to Angular 9 today
  • I upgraded ngx-custom-validators to 9.0.1
  • I tried to compile one of my libraries that uses CustomValidators.email and found it failing
ERROR: projects/profile-lib/src/lib/classes/booking-user.ts:40:88 - error TS2322: Type 'import("/Users/crash/git/uber/uber-spa/node_modules/ngx-custom-validators/node_modules/@angular/forms/forms").ValidatorFn' is not assignable to type 'import("/Users/crash/git/uber/uber-spa/node_modules/@angular/forms/forms").ValidatorFn'.
  Types of parameters 'control' and 'control' are incompatible.
    Type 'import("/Users/crash/git/uber/uber-spa/node_modules/@angular/forms/forms").AbstractControl' is not assignable to type 'import("/Users/crash/git/uber/uber-spa/node_modules/ngx-custom-validators/node_modules/@angular/forms/forms").AbstractControl'.
      Types of property 'validator' are incompatible.
        Type 'import("/Users/crash/git/uber/uber-spa/node_modules/@angular/forms/forms").ValidatorFn' is not assignable to type 'import("/Users/crash/git/uber/uber-spa/node_modules/ngx-custom-validators/node_modules/@angular/forms/forms").ValidatorFn'.
          Types of parameters 'control' and 'control' are incompatible.
            Type 'import("/Users/crash/git/uber/uber-spa/node_modules/ngx-custom-validators/node_modules/@angular/forms/forms").AbstractControl' is not assignable to type 'import("/Users/crash/git/uber/uber-spa/node_modules/@angular/forms/forms").AbstractControl'.
              Types have separate declarations of a private property '_parent'.

Environment information

  • OS: Mac
  • Angular Version: 9.1.0
  • Typescript version: 3.8.3
  • npm version: 6.13.7
  • Node Version: 13.11.0
@bjornharvold
Copy link
Author

Screen Shot 2020-03-26 at 10 23 19 PM

Screen Shot 2020-03-26 at 10 23 08 PM

Screen Shot 2020-03-26 at 10 22 50 PM

@psenechal
Copy link

psenechal commented Mar 26, 2020

I'm also getting errors during compile of this dependency...these occur throughout the code:
ERROR in node_modules/ngx-custom-validators/node_modules/@angular/core/core.d.ts:256:18 - error TS2314: Generic type 'ɵɵFactoryDef' requires 1 type argument(s).

This started occurring after updating the Angular stack from 9.0.7 to 9.1.0
Reverting Angular to 9.0.7 makes the problem disappear, so it must be something they changed between 9.0.7 and 9.1.0 that is causing the issue.

@JanneHarju
Copy link

Yes I have some problem here.

@JotaBritoDev
Copy link

same problem here.. seems we can't upgrade to Angular 9.1 yet.

@JanneHarju
Copy link

I will try to solve this and make PR for it.

@JanneHarju
Copy link

Just version update seems to fix errors. I made PR #34

@rsaenen
Copy link
Owner

rsaenen commented Mar 30, 2020

Thanks a lot!
Released with 9.1.0

@rsaenen rsaenen added the bug label Mar 30, 2020
@JanneHarju
Copy link

I tested new version with my own project and it fix this problem. Thanks.

@mrp67
Copy link

mrp67 commented Mar 30, 2020

Setting the following as peerDependencies and devDependencies and with their versions prefixed with a ^ will prevent this type of issue from happening in the future:

"@angular/common"
"@angular/compiler"
"@angular/core"
"@angular/forms"
"@angular/platform-browser"
"@angular/platform-browser-dynamic"
"@angular/router"
"rxjs",
"tslib"
"zone.js"

@psenechal
Copy link

All good now after the update. Thanks!

@bjornharvold
Copy link
Author

bjornharvold commented Apr 16, 2020

I definitely suggest using peerDependencies. ngx-custom-validators will fail if we do something like this ~9.1.2. It only works if it's set to ~9.1.0. Not a big issue... but only when you know about it. I've had plenty of times when I used ~ or ^ trusting that all updates would automatically be stronger, longer, faster.... and working. That was not the case, to the point that my CI/CD system would pull in a newer version than my local environment quite frequently that did somehow not work. Then we are really all scratching our heads going "Well it works on my machine!" So we started hard coding version numbers and removed all ^ and ~ in package.json. All problems went away... until ngx-custom-validators LOL :-D

@bjornharvold
Copy link
Author

Can we get a version bump here that takes care of this issue? Other than adding correct peerDependencies, is there anything else that needs to be done?

@alfaproject
Copy link

Yes, this should use peerDependencies and only the ones that actually needs. Not the whole framework...

@plackowski
Copy link

..Could somebody tell me what should I update (peerDependencies)? I'm using angular 8.2.14 and it's not working (error: Types of parameters 'control' and 'control' are incompatible. as above). My package.json:

"dependencies": {
"@angular/animations": "~8.2.14",
"@angular/cdk": "^8.2.3",
"@angular/common": "^8.2.14",
"@angular/compiler": "^8.2.14",
"@angular/core": "^8.2.14",
"@angular/fire": "^5.3.0",
"@angular/forms": "^8.2.14",
"@angular/http": "~8.0.0-beta.10",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "^8.2.14",
"@angular/router": "^8.2.14",
"@firebase/testing": "^0.19.0",
"@nativescript/core": "6.5.1",
"@ngx-translate/core": "^12.1.2",
"@ngx-translate/http-loader": "^5.0.0",
"@swimlane/ngx-charts": "^14.0.0",
"@types/jest": "^24.0.0",
"bootstrap": "^4.4.1",
"core-js": "^3.6.2",
"firebase": "^7.14.3",
"hammerjs": "^2.0.8",
"nativescript-angular": "^8.21.0",
"nativescript-gif": "^4.0.2",
"nativescript-intl": "^3.0.0",
"nativescript-plugin-firebase": "^10.5.2",
"nativescript-sound": "^1.0.4",
"nativescript-texttospeech": "^2.0.3",
"nativescript-theme-core": "~2.0.24",
"nativescript-toasty": "^2.0.1",
"nativescript-ui-chart": "^7.1.1",
"nativescript-ui-listview": "^8.1.2",
"nativescript-ui-sidedrawer": "8.0.1",
"nativescript-unit-test-runner": "^0.7.0",
"ngx-custom-validators": "^9.1.0",
"npm-check-updates": "^5.0.0",
"reflect-metadata": "~0.1.13",
"rxjs": "^6.5.5",
"zone.js": "^0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.24",
"@angular/cli": "^8.3.22",
"@angular/compiler-cli": "~8.2.14",
"@nativescript/schematics": "~1.0.0",
"@nativescript/tslint-rules": "~0.0.5",
"@types/jasmine": "3.4.6",
"@types/jasminewd2": "~2.0.8",
"@types/node": "^13.1.6",
"codelyzer": "^5.2.1",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"jest": "^24.0.0",
"jest-preset-angular": "^8.0.0",
"karma": "^5.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.1",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "^1.5.1",
"karma-nativescript-launcher": "0.4.0",
"karma-webpack": "3.0.5",
"nativescript-dev-webpack": "^1.4.1",
"node-sass": "^4.13.1",
"protractor": "^7.0.0",
"ts-node": "~8.6.0",
"tslint": "~5.20.1",
"typescript": "~3.5.3",
"webpack-bundle-analyzer": "^3.6.0",
"webpack-cli": "^3.3.10"
}

@EduardoPires
Copy link

ngx-custom-validators v9.1.0 working in Angular 9.x.x but got broken at Angular v10.0.x

@thatguycodes
Copy link

Hi guys, is there going to be update to ngx-custom-validators? It is broken with Angular v10

@EduardoPires
Copy link

I'm using v8.0 of ngx-custom-validators in Angular v10 and is working fine, only the v9.x causes a breaking

@thatguycodes
Copy link

Thanks, I guess I will I try downgrade and see if it works.

@suhailkc
Copy link

suhailkc commented Aug 6, 2020

I have an issue using equalTo and notEqualTo validators.

<input class="form-control" type="text" placeholder="password" ngModel name="password" #password="ngModel"/>
<input class="form-control" type="text" placeholder="re-enter password" ngModel name="equalToPassword" #equalToPassword="ngModel" [equalTo]="password"/>

<p *ngIf="equalToPassword?.errors?.equalTo">equalTo error</p>

Error when ng build --prod :

Type 'NgModel' is missing the following properties from type 'FormControl': setValue, patchValue, registerOnChange, registerOnDisabledChange, and 28 more.

same as: https://stackblitz.com/edit/angular-ivy-ipk5rp (from #38 )

Versions:
Angular: 10.0.7
ngx-custom-validators: ^8.0.0 (downgraded from ^9.1.0 because of error in Angular 10)

Could anybody know the solution?

@phil123456
Copy link

same here, downgrading to 8.0 made it work with angular 10

@diegorvieira17
Copy link

I tried to use the version 11.0.1 of this package in an application with angular version 11 and had the same problem. Any prediction if solution of the problem?

@ThiagoMSArrais
Copy link

I'm using v8.0 of ngx-custom-validators in Angular v10 and is working fine, only the v9.x causes a breaking

That's working for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests