google-pay / google-pay-button

Google Pay button - React, Angular, and custom element
Apache License 2.0
250 stars 60 forks source link

Type error when using version >3.0.1 with Angular 14 #205

Open clates opened 1 year ago

clates commented 1 year ago

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:

  1. Initialize a blank Angular 14 repository
  2. yarn add @google-pay/button-angular
  3. Observe that the project fails to compile.
  4. Update the dependency to 3.0.1 / 3.0.0
  5. Observe that the project now compiles.

Expected behavior No type error

Component information:

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

dmengelt commented 1 year ago

Thanks @clates for reporting this. If you use skipLibCheck: true in your Angular 14 app it works for your. Correct?

clates commented 1 year ago

If you use skipLibCheck: true in your Angular 14 app it works for your. Correct?

Yes, that's correct.

oritpersik commented 1 year ago

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 )

dmengelt commented 1 year ago

@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.