0

I have script tag like this:

<script type="text/javascript" src="http://url.com/foo.min.js"></script>

And then I just want to use the object from that js file inside my typescript like below

Foo.create('element', {
    "title": "foo",
    "description": "bar",
});

I got the error warning on Foo inside my Typescript. Is there any way that I can use Foo object like Javascript?

1 Answer 1

4

Try this:

declare var Foo: any;

You can get more specific than any if you wish, providing better typing information, but this should get you started.

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

3 Comments

I got error like Unexpected token. A constructor, method, accessor, or property was expected for declare
@SeizeDuh where did you put your declare statement?
Now I realised I should put that on top.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.