Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nothing that a little `var unsafe = original as any;` couldn't solve!


To be a bit more explanatory: You can cast to the "any" type by adding `as any` to any variable, and it will then work just like Javascript. Typescript will know not to infer types from it or complain about it, and for that variable (which could be a simple variable or an entire library) will work just as it would in regular javascript. I typically use this when testing out a new library that doesn't have Typescript types so I can get a feel for it (and if I like it, I"ll progressively add types to it; its a very nice process imo).




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

Search: