I've recently discovered that type hinting, while it doesn't actually do that much as far as how the code runs, can work minor miracles in getting an IDE like VSCode to finally "know" where a lot of attributes, methods and function calls actually come from.
This can be enormously helpful when trying to understand what's happening in the code. In VSCode you can even Cmd+Click on the names of the objects it "understands" and it will take you right to where the object is defined, or show you the list of references.
It was a big jump for me to understand that type hinting was not just about maybe helping a pre-compiler throw a warning that an argument was not receiving an int or whatever. Turns out it goes way beyond that, and I can make a bunch of "generic" function calls and unhighlighted attributes/methods light up with correct highlight colors, and have useful information available, just by type hinting the appropriate class like this:
This example cleared up a lot of incomplete highlighting in the defined function. But most functions only need one or two of the arguments to be type hinted to fix things that VSCode can't identify.
I've been able to clear up at least 90% or more of the unidentified objects in a couple of modules already, just by figuring out what kind of object to use for the type hinting. Would you have any objection to receiving a few PRs that just add some of this type hinting to different parts of the project?
@joshgoebel
I've recently discovered that type hinting, while it doesn't actually do that much as far as how the code runs, can work minor miracles in getting an IDE like VSCode to finally "know" where a lot of attributes, methods and function calls actually come from.
This can be enormously helpful when trying to understand what's happening in the code. In VSCode you can even Cmd+Click on the names of the objects it "understands" and it will take you right to where the object is defined, or show you the list of references.
It was a big jump for me to understand that type hinting was not just about maybe helping a pre-compiler throw a warning that an argument was not receiving an
int
or whatever. Turns out it goes way beyond that, and I can make a bunch of "generic" function calls and unhighlighted attributes/methods light up with correct highlight colors, and have useful information available, just by type hinting the appropriate class like this:This example cleared up a lot of incomplete highlighting in the defined function. But most functions only need one or two of the arguments to be type hinted to fix things that VSCode can't identify.
I've been able to clear up at least 90% or more of the unidentified objects in a couple of modules already, just by figuring out what kind of object to use for the type hinting. Would you have any objection to receiving a few PRs that just add some of this type hinting to different parts of the project?