verygoodsecurity / vgs-collect-js

VGS Collect.js script loading module
https://www.verygoodsecurity.com/
7 stars 17 forks source link

ERROR in node_modules/@vgs/collect-js/dist/index.d.ts:1:41 - error TS2304: Cannot find name 'IConfig'. #22

Closed jappypreens closed 3 years ago

jappypreens commented 3 years ago

Expected Behavior

After installing the dependency my project should be able to compile

Current Behavior

After installing the vgs-collect-js package I try and build/run my Angular project. I've got an Ionic Angular project and get the following error:

ERROR in node_modules/@vgs/collect-js/dist/index.d.ts:1:41 - error TS2304: Cannot find name 'IConfig'.
1 declare const loadVGSCollect: (config?: IConfig) => Promise<unknown>;

Possible Solution

Include the IConfig type in the package

Steps to Reproduce (for bugs)

  1. Install vgs-collect-js package
  2. run ionic serve (Ionic, Angular project)

Context

I'm trying to make use of this package but my project wont build or run locally due to the missing type

Your Environment

joemun commented 3 years ago

+1 to missing types. I realize this module is just a wrapper around fetching the actual Collect.js script... but would be nice if the TS type definitions could be provided for the APIs in the script itself. I am having to write a type def file inside my own project, by reading through the documentation at https://www.verygoodsecurity.com/docs/vgs-collect/js/integration

AnnaKudriasheva commented 3 years ago

@jappypreens @joemun thank you for pointing this out. The issue fix is coming soon.

AnnaKudriasheva commented 3 years ago

@jappypreens @joemun could you please check if the issue still exists in the latest recently released version 0.4.0? Thank you!

joemun commented 3 years ago

Looks like the PR will address @jappypreens original issue, but they can confirm.

The ask I brought up and piggybacked on, perhaps should have been filed as a separate issue:

+1 to missing types. I realize this module is just a wrapper around fetching the actual Collect.js script... but would be nice if the TS type definitions could be provided for the APIs in the script itself. I am having to write a type def file inside my own project, by reading through the documentation at https://www.verygoodsecurity.com/docs/vgs-collect/js/integration

I realize the solution here probably isn't super clean cut, since the Collect API itself is decoupled from this loader script. Thanks for following up.