Intellisense: Add reference path for TypeScript.
Fixes #676.
Code: Various analysis fixes.
(only 3 warnings left)