0

Using meteor I add jquery and three.js through meteor packages. And a simple javascript file runs to produce the spinning cube example.

Now I change my file.js to file.ts and it Errors: can't find the $jquery or THREE.

Basically the question is what do I have to do to include libraries through meteor so I can use typescript?

5
  • With typescript you do not have an implicit global namespace anymore. You need to either export or import libs you want to use. This might be relevant too Commented Sep 6, 2015 at 15:08
  • I've looked at this... but it seems the problem is that when I change from js to ts that it tries to run the code before it loads the libraries. Commented Sep 6, 2015 at 15:18
  • There must be hundreds of people using these libraries with meteor I think I'm missing something really basic. Commented Sep 6, 2015 at 15:22
  • Could this simply be a matter of your project structure for loading the js files ? In short they are loaded (from first to last): Files within a "lib" named folder, the longest (deepest) path, then by alphabetical order. more here Commented Sep 6, 2015 at 18:41
  • Using meteor, the libraries are kept in a packages folder; That's ok, it must be at the point of compilation; from TS to JS that it wants to know about the included libraries.... It's not mission critical to my project so I'm going to seperate my typescript stuff into a file with no dependancies, untill I find the way. Commented Sep 6, 2015 at 20:12

1 Answer 1

0

This should work: https://atmospherejs.com/meteortypescript/compiler

'TypeScript is supported on both the client and the server. Files ending with .ts are automatically compiled to JavaScript by this meteor plugin.'

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

1 Comment

I've looked at this... but it seems the problem is that when I change from js to ts that it tries to run the code before it loads the libraries.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.