Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsafe region of code in TypeScript

Tags:

typescript

Sometimes it is hard to come up with valid TypeScript, for example when you reference a library that has tons of entities each of which needs its declaration. In situations like this it would be nice to tell TypeScript to skip a part of code that deals with that library considering it valid. So is there a way to do that in TypeScript?

like image 989
Trident D'Gao Avatar asked Feb 07 '13 18:02

Trident D'Gao


1 Answers

There isn't a way to turn off type checking for an entire block of code, but if you access anything off an expression of type any, the result will also be any, so if you can access the library through an any reference of any sort, you'll effectively be working without type checking.

like image 109
Ryan Cavanaugh Avatar answered Oct 20 '22 14:10

Ryan Cavanaugh