Hacker News new | past | comments | ask | show | jobs | submit login

I recently also started using Browserify with Typescript (along with tds to get some ambient files for popular libraries). I got it to work after tryping countless of hacky things.

What I ended up with was a seperate ts file that is just the module, and variables I export. See this:

http://jsbin.com/gidaneja/1/edit?js,output

So I do a "<reference path=" for the ambient paths of variables. Then I declare require so I can call browserify's require. Then I create a function with it's return type being used based on ambient files I included. Then I create an export variable and call the function to set it's value. Then I can use that variable without a problem everywhere.

I tried using the whole "import lodash = require('lodash.d.ts') thing and other variations and failed miserably. This is the only thing I got to work, and its working perfectly. Email me (email should be on my profile) if it's not clear, I know the explanation was kinda vague.




Awesome, thanks! will try it :)


Happy to help. Let me know how it goes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: