1. 29
  1.  

  2. 2

    I love unknown it’s an excellent placeholder during the process of converting something from JS to TS, lets you give things names right now ( type Customer = unknown ) and then fill in the details later, whereas if you use any you have to give up a lot of helpful feedback as you work. I wish every type system had it for in-progress work.

    1. 2

      That’s a helpful idea, thanks! Any other tips or tricks for converting a JS code base to TS? Got a big production app, and I’d like to get my team working on migrating it to TS.

      1. 2

        Bite off a piece at a time, and don’t be afraid to keep interface defs private to a module (at first), even if the same object is being used elsewhere. TSC will still tell you when the actual properties don’t line up, and you can normalise them later.

    2. 2

      If you’re converting from Flow to TS, the equivalent in Flow is the type called mixed.