4 ms·
No, I think solomatov is saying you can always use the 'any' type built-in to TypeScript. You can always do: declare var fancyNewLib: any; fancyNewLib
by calebegg 10y ago
No, I think solomatov is saying you can always use the 'any' type built-in to TypeScript. You can always do:
declare var fancyNewLib: any;
fancyNewLib('hello');
fancyNewLib.someCoolFeature = 3;
You don't get any suggestions or typechecking (obviously), but you're no worse off than just using JS in that sense. And you can easily replace your 'declare' with the actual // <reference> tag when you find it or make it, and clean up any errors.
- k__ 10y agoAh, yes, that's what I'm doing most of the time. But like you said it's no better than using JS directly, haha.
- swax 10y agoJust changing the file extension from js to ts will often bring out bugs in your code. The type inference will often catch things. Functions that are declared multiple types or that have duplicate parameters, and a lot of other stuff will be caught.
- solomatov 10y agoActually, it's better. If the core of your application has non trivial business logic, it's a good idea to write it in typed way and write ui and other support stuff with partially typed code.
- k__ 10y agoFair enough and I think with strict null type checking, where null/undefined isn't part of any anymore things would still get much better than with plain JS.