0

This is the link for the 3rd party script file jsfiddle example link, but in that external file is the 3rd party js script file it having the all functions are self-invoked functions.

How can I declare that function in the ts file?

After declaring the variable in ts file, I need to call the below 3rd party function.

affirm.checkout.open({
     success: function (card_details) {
       console.log('#### calling affirm.checkout.open');
     },
     error: function (error_response) {
       console.log('#### calling affirm.checkout.open Error =======');
     },
     checkout_data: ObjectData;
   });

While am running the application getting the ERROR in src/app/components/checkout/checkout.component.ts(1572,5): error TS2304: Cannot find name 'affirm'.

Please can anyone help me out.

1 Answer 1

0

add the script to the scripts array in the angular.json file:

        "scripts": [
          "src/script.js"
        ]

after that, you can use it inside typescript file by declaring a variable for it.

Sign up to request clarification or add additional context in comments.

1 Comment

I already did that one and in that script file having the self invoked functions, I don't know how to declare the variable of the self invoked functions. @ Turzo Ahsan Sami thank you for your reply.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.