Type error when using version >3.0.1 with Angular 14
Describe the bug A clear and concise description of what the bug is.
When installing @google-pay/button-angular via yarn add @google-pay/button-angular on an Angular 14 project, you will encounter the following error.
Error: node_modules/@google-pay/button-angular/button-angular/lib/google-pay-button.component.d.ts:35:18 - error TS2707: Generic type 'ɵɵDirectiveDeclaration' requires between 6 and 8 type arguments.
35 static ɵdir: i0.ɵɵDirectiveDeclaration<GooglePayButtonComponent, "google-pay-button", never, { "paymentRequest": "paymentRequest"; "environment": "environment"; "existingPaymentMethodRequired": "existingPaymentMethodRequired"; "buttonColor": "buttonColor"; "buttonType": "buttonType"; "buttonSizeMode": "buttonSizeMode"; "buttonLocale": "buttonLocale"; "paymentDataChangedCallback": "paymentDataChangedCallback"; "paymentAuthorizedCallback": "paymentAuthorizedCallback"; "readyToPayChangeCallback": "readyToPayChangeCallback"; "loadPaymentDataCallback": "loadPaymentDataCallback"; "cancelCallback": "cancelCallback"; "errorCallback": "errorCallback"; "clickCallback": "clickCallback"; }, {}, never, never, false, never
To Reproduce Steps to reproduce the behavior:
- Initialize a blank Angular 14 repository
yarn add @google-pay/button-angular- Observe that the project fails to compile.
- Update the dependency to
3.0.1/3.0.0 - Observe that the project now compiles.
Expected behavior No type error
Component information:
-
Component
- [ ] React component (
@google-pay/button-react) - [ ] Custom element (
@google-pay/button-element) - [x] Angular component (
@google-pay/button-angular)
- [ ] React component (
-
Component version (e.g. 1.0.0):
> 3.0.1
Additional context Add any other context about the problem here.
Workaround
3.0.1-3.0.0 compile fine. Suspect something went wrong during the Angular 15 upgrade in the 3.0.2 release.
You could also keep the 3.0.5 and skipLibCheck: true in your tsconfig.json
See a functional example on a fresh Ang14 repository here using 3.0.0 and the non-functional 3.0.5 example here
Thanks @clates for reporting this. If you use skipLibCheck: true in your Angular 14 app it works for your. Correct?
If you use skipLibCheck: true in your Angular 14 app it works for your. Correct?
Yes, that's correct.
Any news? I don't want to use skipLibCheck: true. and I want to use the updated version of this library ( I work with angular14 too )
@oritpersik Unfortunately not. At the moment you have to use skipLibCheck: true. We will think about potentially supporting multiple major Angular versions in the future.