Skip to content

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

@clates

Description

@clates

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:

  • Component

    • React component (@google-pay/button-react)
    • Custom element (@google-pay/button-element)
    • Angular component (@google-pay/button-angular)
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions