4 ms·
‘any’ is great for porting javascript into typescript, and integrating with javascript libraries. You can add types gradually, without everything grinding to a
by bazoom42 4y ago
‘any’ is great for porting javascript into typescript, and integrating with javascript libraries. You can add types gradually, without everything grinding to a halt.
- schwartzworld 4y agoAdding types to code that was written with `any` is going to be much harder than using `unknown`.
- bazoom42 4y agoThe point is if you have existing JavaScript you want to integrate with TypeScript. You should not need ‘any’ in code written in TypeScript from the beginning.
- schwartzworld 4y agoSure, but at least with unknown you will have done some narrowing. Writing Typescript well requires some fundamentally different patterns than javascript. Adding types afterward is like pulling out your teeth slowly.