@Moon you can set up barriers like “until now this has been any, from this point onwards I am declaring that I know it to be X” and vice versa at pretty much any point of the code, but modules are an especially good start, as with TS you often also declare and import types, which fit naturally into the other imports of the module.