3

I Generate the Angular JS code through the Typescript code. In one situation, I need to add external JS file to my typescript file and need to access the classes in the js file.

I add that js file like this.

/// <amd-dependency path="../../vendor/tweenMax.js" />

But still the typescript file can not identify the objects of that javascript file.

If someone knows the suitable way, please add your answer. (I'm using min. js file)

1 Answer 1

6

You need a .d.ts file (TypeScript definition file) for any non-TypeScript packages. The dependency references are only for TypeScript files (not plain js).

https://github.com/borisyankov/DefinitelyTyped

If a .d.ts file does not exist for your addin you can simply define an interface for it yourself (so that it thinks it exists).

It is purely for the strong-typing that it needs any definition, otherwise you can just cast your variable with <any> and call anything on it (whether it exists or not, just like normal JS) :)

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

Comments

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.